Skip to content

Commit

Permalink
[PostHog#189] Adding minSessionDuration to config and update usage
Browse files Browse the repository at this point in the history
  • Loading branch information
karntrehan committed Oct 17, 2024
1 parent 85f6ef1 commit ca15b03
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 45 deletions.
2 changes: 2 additions & 0 deletions USAGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ val config = PostHogAndroidConfig(apiKey).apply {
sessionReplayConfig.screenshot = false
// debouncerDelayMs is 500ms by default
sessionReplayConfig.debouncerDelayMs = 1000
// minSessionDurationMs is 1000ms by default
sessionReplayConfig.minSessionDurationMs = 2000
}
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,55 @@ import com.posthog.PostHogExperimental

@PostHogExperimental
public class PostHogSessionReplayConfig
@JvmOverloads
constructor(
/**
* Enable masking of all text input fields
* Defaults to true
* This isn't supported if using Jetpack Compose views, use with caution
*/
@PostHogExperimental
public var maskAllTextInputs: Boolean = true,
/**
* Enable masking of all images to a placeholder
* Defaults to true
* This isn't supported if using Jetpack Compose views, use with caution
*/
@PostHogExperimental
public var maskAllImages: Boolean = true,
/**
* Enable capturing of logcat as console events
* Defaults to true
*/
@PostHogExperimental
public var captureLogcat: Boolean = true,
/**
* Converts custom Drawable to Bitmap
* By default PostHog tries to convert the Drawable to Bitmap, the supported types are
* BitmapDrawable, ColorDrawable, GradientDrawable, InsetDrawable, LayerDrawable, RippleDrawable
*/
@PostHogExperimental
public var drawableConverter: PostHogDrawableConverter? = null,
/**
* By default Session replay will capture all the views on the screen as a wireframe,
* By enabling this option, PostHog will capture the screenshot of the screen.
* The screenshot may contain sensitive information, use with caution.
*/
@PostHogExperimental
public var screenshot: Boolean = false,
/**
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
* This is used for capturing the view as a wireframe or screenshot
* The lower the number more snapshots will be captured but higher the performance impact
* Defaults to 500ms
*/
@PostHogExperimental
public var debouncerDelayMs: Long = 500,
)
@JvmOverloads
constructor(
/**
* Enable masking of all text input fields
* Defaults to true
* This isn't supported if using Jetpack Compose views, use with caution
*/
@PostHogExperimental
public var maskAllTextInputs: Boolean = true,
/**
* Enable masking of all images to a placeholder
* Defaults to true
* This isn't supported if using Jetpack Compose views, use with caution
*/
@PostHogExperimental
public var maskAllImages: Boolean = true,
/**
* Enable capturing of logcat as console events
* Defaults to true
*/
@PostHogExperimental
public var captureLogcat: Boolean = true,
/**
* Converts custom Drawable to Bitmap
* By default PostHog tries to convert the Drawable to Bitmap, the supported types are
* BitmapDrawable, ColorDrawable, GradientDrawable, InsetDrawable, LayerDrawable, RippleDrawable
*/
@PostHogExperimental
public var drawableConverter: PostHogDrawableConverter? = null,
/**
* By default Session replay will capture all the views on the screen as a wireframe,
* By enabling this option, PostHog will capture the screenshot of the screen.
* The screenshot may contain sensitive information, use with caution.
*/
@PostHogExperimental
public var screenshot: Boolean = false,
/**
* Deboucer delay used to reduce the number of snapshots captured and reduce performance impact
* This is used for capturing the view as a wireframe or screenshot
* The lower the number more snapshots will be captured but higher the performance impact
* Defaults to 500ms
*/
@PostHogExperimental
public var debouncerDelayMs: Long = 500,
/**
* Define the minimum duration for sessions to be recorded.
* This is useful if you want to exclude sessions that are too short to be useful.
* Defaults to 1000ms
*/
@PostHogExperimental
public var minSessionDurationMs: Long = 1000,
)
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class MyApp : Application() {
sessionReplayConfig.maskAllImages = false
sessionReplayConfig.captureLogcat = true
sessionReplayConfig.screenshot = true
sessionReplayConfig.minSessionDurationMs = 2000
}
PostHogAndroid.setup(this, config)
}
Expand Down

0 comments on commit ca15b03

Please sign in to comment.