diff --git a/docs/sources/web-trackers/tracker-setup/initialization-options/index.md b/docs/sources/web-trackers/tracker-setup/initialization-options/index.md index 34aeb568b..63a39c6bb 100644 --- a/docs/sources/web-trackers/tracker-setup/initialization-options/index.md +++ b/docs/sources/web-trackers/tracker-setup/initialization-options/index.md @@ -111,6 +111,7 @@ The following table shows all the configuration parameters. These are **all opti | [`maxLocalStorageQueueSize`](/docs/sources/web-trackers/cookies-and-local-storage/configuring-cookies/index.md#local-storage-queue-size) | Maximum events to queue in local storage when they are failing to send. | 1000 | `int` | | [`useLocalStorage`](/docs/sources/web-trackers/configuring-how-events-sent/index.md) | Whether the event queue persists to localStorage. | `true` | `boolean` | | [`useStm`](/docs/sources/web-trackers/configuring-how-events-sent/index.md) | Whether to add the sent timestamp to GET events. | `true` | `boolean` | +| [`disableSessionContextWithinWebView`](/docs/sources/web-trackers/tracking-events/webview/index.md) | Suppress the `client_session` entity when running inside a mobile WebView, preventing duplicate session entities in hybrid apps. | `false` | `boolean` | ## Example configuration code diff --git a/docs/sources/web-trackers/tracking-events/webview/index.md b/docs/sources/web-trackers/tracking-events/webview/index.md index 8ae316866..41a89310d 100644 --- a/docs/sources/web-trackers/tracking-events/webview/index.md +++ b/docs/sources/web-trackers/tracking-events/webview/index.md @@ -80,6 +80,28 @@ The forwarded events will have the web tracker version, e.g. "js-4.3.0", but the Hybrid events are still compatible with the Snowplow [Unified Digital dbt model](/docs/modeling-your-data/modeling-your-data-with-dbt/dbt-models/dbt-unified-data-model/index.md). +### Suppress the client session entity in WebViews + +:::note +This feature is available since version 4.10 of the tracker. +::: + +When `contexts.session: true` is set on the JavaScript tracker running inside a WebView, the forwarded events carry both a web-side `client_session` entity (from the JavaScript tracker's cookie or local storage) and a native-side `client_session` entity (added by the mobile tracker). This produces two `client_session` entities per event, which causes logic errors and mismatched session IDs in downstream data. + +To prevent this, set `disableSessionContextWithinWebView: true` in the tracker configuration. When this option is enabled and the tracker detects a mobile WebView interface at event-fire time, it skips attaching its own `client_session` entity. The mobile tracker's session entity is still added, so session data remains complete. + +```javascript +newTracker('sp1', '{{collector_url}}', { + contexts: { + session: true, + }, + disableSessionContextWithinWebView: true, // suppress web-side session entity in WebViews + plugins: [ WebViewPlugin() ], +}); +``` + +This option defaults to `false` (opt-in). Enable it whenever you use `contexts.session: true` alongside the WebView plugin in a hybrid app. + ## Install plugin