Release/4.10.0 - #1495
Merged
Merged
Conversation
…PA referrer tracking (close #1461) (#1491) * loop: implement snowplow-javascript-tracker (loop/3a607af295a280da8c2adea3051ca267-snowplow-javascript-tracker) * loop: implement snowplow-javascript-tracker (loop/3a607af295a280da8c2adea3051ca267-snowplow-javascript-tracker) * loop: implement snowplow-javascript-tracker (loop/3a607af295a280da8c2adea3051ca267-snowplow-javascript-tracker) --------- Co-authored-by: snowplow-loop[bot] <snowplow-loop[bot]@users.noreply.github.com>
…ture flag (close #1455) (#1493) * loop: implement snowplow-javascript-tracker (loop/gh-snowplow-incubator-refine-agent-129-snowplow-javascript-tracker) * loop: implement snowplow-javascript-tracker (loop/gh-snowplow-incubator-refine-agent-129-snowplow-javascript-tracker) * loop: implement snowplow-javascript-tracker (loop/gh-snowplow-incubator-refine-agent-129-snowplow-javascript-tracker) * loop: implement snowplow-javascript-tracker (loop/gh-snowplow-incubator-refine-agent-129-snowplow-javascript-tracker) --------- Co-authored-by: snowplow-loop[bot] <snowplow-loop[bot]@users.noreply.github.com>
…tialization (#1490) The tracker called `getBrowserProperties()` at construction time (`tracker/index.ts:330`), which reads layout geometry (`scrollWidth`, `scrollHeight`, `offsetWidth`) and triggers a forced reflow on every page that loads the tracker. Google PageSpeed Insights flags this as a performance issue. This change removes that init-time call. The four properties that were actually needed at construction (`cookiesEnabled`, `colorDepth`, `browserLanguage`, `resolution`) are now read directly from non-layout APIs: ```ts const cookiesEnabled = window.navigator.cookieEnabled; const colorDepth = screen.colorDepth; const browserLanguage = window.navigator.language || (window.navigator as any).userLanguage; const resolution = makeDimension(screen.width, screen.height); ``` The first call to `readBrowserProperties()` — which does read layout — is deferred to first event build time: via `getBrowserContextPlugin.contexts()` when `contexts.browser: true`, or `getBrowserDataPlugin.beforeTrack()` in the default config. Both paths share the existing module-level `cachedProperties`, so layout is read exactly once per page lifecycle. The ResizeObserver+rAF path continues to handle all subsequent cache updates. Co-authored-by: snowplow-loop[bot] <snowplow-loop[bot]@users.noreply.github.com>
…tion (#1494) ## What and why In hybrid native+WebView deployments the JavaScript tracker and the native mobile tracker both attach a `client_session` entity to every event. This produces two `client_session` entities on WebView events, which causes `dbt-snowplow-unified` to drop or misattribute sessions because it expects exactly one per event. The current workaround — wrapping `contexts.session` in a `hasMobileInterface()` call — is undocumented, brittle (requires an extra import), and easy to get wrong. This PR introduces `disableSessionContextWithinWebView: boolean` (default `false`) on `TrackerConfiguration`. When enabled and a V2 WebView interface is present at event-fire time, the tracker skips attaching `client_session`. ## Implementation **`browser-tracker-core/src/tracker/types.ts`** — added `disableSessionContextWithinWebView?: boolean` with JSDoc. **`browser-tracker-core/src/tracker/index.ts`** — reads the new config (defaulting to `false`), adds a private `isInWebView()` helper that checks the three stable V2 interface identifiers: ``` window.SnowplowWebInterfaceV2 window.webkit?.messageHandlers?.snowplowV2 window.ReactNativeWebView ``` This mirrors `hasMobileInterface()` in `@snowplow/webview-tracker` without adding a dependency on that package — which would otherwise bundle it for all tracker users regardless of whether they use WebView tracking. The session-entity guard is extended to also skip when `configDisableSessionInWebView && isInWebView()`. **Tests** — three cases in `session_data.test.ts`: (a) option `true` + WebView detected → no `client_session` in payload; (b) option explicitly `false` + WebView detected → `client_session` present; (c) option absent + WebView detected → `client_session` present (backward compat). One case added to `browser-plugin-webview/test/webview.test.ts` verifying the forwarded `context` array excludes `client_session` when the option is active. **Rush change file** — minor bump for `@snowplow/browser-tracker-core`. ## Reviewer notes - The `isInWebView()` check intentionally reads `window` directly (not via a mock/DI seam) to stay consistent with how the existing `contexts.session` guard already evaluates at runtime. - Default is `false` (opt-in) so existing hybrid deployments are unaffected without a major-version bump. - No changes to the public plugin API; `browser-plugin-webview` and `browser-tracker-core` are the only touched packages. --- _Draft PR opened for review — please verify and run CI before merging._ --------- Co-authored-by: snowplow-loop[bot] <snowplow-loop[bot]@users.noreply.github.com>
|
Thanks for your pull request. Is this your first contribution to a Snowplow open source project? Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://docs.snowplowanalytics.com/docs/contributing/contributor-license-agreement/ to learn more and sign. Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note: the workflow flagged #1494 and #1490 as external contributions, but the author is
snowplow-claude-review[bot]— a Snowplow-owned bot, not an external contributor — so I've omitted the "thanks to" attribution. Add it back if you want the bot credited.New features
disableSessionContextWithinWebViewoption (feat(browser-tracker-core): add disableSessionContextWithinWebView option #1494)preserveOriginalReferreroption for SPA referrer tracking (feat(browser-tracker-core): add preserveOriginalReferrer option for SPA referrer tracking (close #1461) #1491)Bug fixes