diff --git a/contents/docs/integrate/feature-flags-code/_snippets/feature-flags-code-android.mdx b/contents/docs/integrate/feature-flags-code/_snippets/feature-flags-code-android.mdx index 23964c015e98..f3fc9008522b 100644 --- a/contents/docs/integrate/feature-flags-code/_snippets/feature-flags-code-android.mdx +++ b/contents/docs/integrate/feature-flags-code/_snippets/feature-flags-code-android.mdx @@ -38,7 +38,7 @@ import com.posthog.android.PostHogAndroidConfig import com.posthog.PostHogOnFeatureFlags // During SDK initialization -val config = PostHogAndroidConfig(apiKey).apply { +val config = PostHogAndroidConfig("").apply { onFeatureFlags = PostHogOnFeatureFlags { if (PostHog.isFeatureEnabled("flag-key")) { // do something diff --git a/contents/docs/session-replay/_snippets/android-logging.mdx b/contents/docs/session-replay/_snippets/android-logging.mdx new file mode 100644 index 000000000000..89a0c0951f50 --- /dev/null +++ b/contents/docs/session-replay/_snippets/android-logging.mdx @@ -0,0 +1,12 @@ +You can enable this feature from your client-side by setting `captureLogcat = true` in our [Android SDK config](/docs/session-replay/installation?tab=Android#step-two-configure-replay-settings). + +```android_kotlin +val config = PostHogAndroidConfig(apiKey = "").apply { + // Enable session recording. Requires enabling in your project settings as well. + // Default is false. + sessionReplay = true + // Capture logs automatically. Default is true. + sessionReplayConfig.captureLogcat = true + ... +} +``` diff --git a/contents/docs/session-replay/_snippets/ios-installation.mdx b/contents/docs/session-replay/_snippets/ios-installation.mdx index 44d46ffba4ed..aac70a5357d4 100644 --- a/contents/docs/session-replay/_snippets/ios-installation.mdx +++ b/contents/docs/session-replay/_snippets/ios-installation.mdx @@ -13,7 +13,7 @@ import IOSInstall from "../../integrate/_snippets/install-ios.mdx" Add `config.sessionReplay = true` to your PostHog configuration alongside any of your other configuration options: ```swift -let config = PostHogConfig(apiKey: apiKey) +let config = PostHogConfig(apiKey: "") // Enable session recording. Requires enabling in your project settings as well. // Default is false. config.sessionReplay = true diff --git a/contents/docs/session-replay/_snippets/react-native-installation.mdx b/contents/docs/session-replay/_snippets/react-native-installation.mdx index 01b5c7452946..1acb35fcbdfa 100644 --- a/contents/docs/session-replay/_snippets/react-native-installation.mdx +++ b/contents/docs/session-replay/_snippets/react-native-installation.mdx @@ -26,7 +26,7 @@ Add `enableSessionReplay: true` to your PostHog configuration alongside any of y ```js export const posthog = new PostHog( - 'apiKey', + '', { // Enable session recording. Requires enabling in your project settings as well. // Default is false. @@ -59,7 +59,7 @@ Or using the `PostHogProvider`: ```js **Note:** Console log recording is only available for Android. + +```js +export const posthog = new PostHog( + '', + { + // Enable session recording. Requires enabling in your project settings as well. + // Default is false. + enableSessionReplay: true, + sessionReplayConfig: { + // Capture logs automatically. Default is true. + // Android only (Native Logcat only) + captureLog: true, + ... + }, + }, +); +``` diff --git a/contents/docs/session-replay/_snippets/react-native-network.mdx b/contents/docs/session-replay/_snippets/react-native-network.mdx index f1bdc3f4b5e6..f4de3e71c867 100644 --- a/contents/docs/session-replay/_snippets/react-native-network.mdx +++ b/contents/docs/session-replay/_snippets/react-native-network.mdx @@ -4,7 +4,7 @@ To capture network requests in your recordings, add `captureNetworkTelemetry: tr ```js export const posthog = new PostHog( - 'apiKey', + '', { // Enable session recording. Requires enabling in your project settings as well. // Default is false. diff --git a/contents/docs/session-replay/_snippets/web-logging.mdx b/contents/docs/session-replay/_snippets/web-logging.mdx new file mode 100644 index 000000000000..8c272fa2deb0 --- /dev/null +++ b/contents/docs/session-replay/_snippets/web-logging.mdx @@ -0,0 +1,11 @@ +As console logs can contain sensitive information, we do not capture these logs automatically. You can enable this feature globally _either_ from your [project settings](https://us.posthog.com/settings/project-replay#replay) **or** client-side by setting `enable_recording_console_log: true` in our [JavaScript Web SDK config](/docs/integrate/client/js/#config). + +```js-web +posthog.init('', { + api_host: '', + enable_recording_console_log: true, // TIP: This is only needed if you aren't configuring session replay using the project settings toggle. + // ... other options +}) +``` + +> **Important:** Individual console logs are truncated at 2000 characters. The rest of the log is not sent to PostHog. When truncating a log message we add `...[Truncated]` to the message. diff --git a/contents/docs/session-replay/console-log-recording.mdx b/contents/docs/session-replay/console-log-recording.mdx index 2bb3a8201d3d..e67662bb4ca8 100644 --- a/contents/docs/session-replay/console-log-recording.mdx +++ b/contents/docs/session-replay/console-log-recording.mdx @@ -6,19 +6,31 @@ availability: enterprise: full --- -PostHog can capture console logs, info, warnings, and errors from your application. This is useful for debugging and providing extra context on what is happening in your user's browser environment. - -As console logs can contain sensitive information, we do not capture these logs automatically. You can enable this feature globally _either_ from your [project settings](https://us.posthog.com/settings/project-replay#replay) **or** client-side by setting `enable_recording_console_log: true` in our [JavaScript Web SDK config](/docs/integrate/client/js/#config). - -```js-web -posthog.init('', { - api_host: '', - enable_recording_console_log: true, // TIP: This is only needed if you aren't configuring session replay using the project settings toggle. - // ... other options -}) -``` - -> **Important:** Individual console logs are truncated at 2000 characters. The rest of the log is not sent to PostHog. When truncating a log message we add `...[Truncated]` to the message. +import Tab from "components/Tab" +import WebLogging from "./_snippets/web-logging.mdx" +import AndroidLogging from "./_snippets/android-logging.mdx" +import ReactNativeLogging from "./_snippets/react-native-logging.mdx" + +PostHog can capture console logs, info, warnings, and errors from your application. This is useful for debugging and providing extra context on what is happening in your user's browser or mobile device environment. + + + + Web + Android + React Native + + + + + + + + + + + + + ## Viewing and searching console logs diff --git a/contents/docs/session-replay/network-recording.mdx b/contents/docs/session-replay/network-recording.mdx index 67c3447add3e..fd64f4467f80 100644 --- a/contents/docs/session-replay/network-recording.mdx +++ b/contents/docs/session-replay/network-recording.mdx @@ -14,7 +14,7 @@ import ReactNativeNetwork from "./_snippets/react-native-network.mdx" Session replay allows you to capture network requests and responses, providing insights into network performance and potential issues. This feature can be particularly useful for debugging and optimizing your application's network interactions. - + Web Android