The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Bump @snowplow/browser-tracker to 4.10.2 (#82955)
Andrei Chernykhfc5cf5c4695e
diff --git a/bun.lock b/bun.lockindex e0e56f6b2fc..13b4dc14bab 100644--- a/bun.lock+++ b/bun.lock@@ -42,7 +42,7 @@"@modelcontextprotocol/ext-apps": "^1.3.2","@react-oauth/google": "^0.11.1","@reduxjs/toolkit": "^2.12.0",- "@snowplow/browser-tracker": "3.2.0",+ "@snowplow/browser-tracker": "4.10.2","@tanstack/react-table": "^8.21.3","@tanstack/react-virtual": "^3.13.2","@tiptap/core": "^3.31.3",@@ -1461,11 +1461,11 @@"@sinonjs/fake-timers": ["@sinonjs/[email protected]", "", { "dependencies": { "@sinonjs/commons": "^3.0.1" } }, "sha512-36/hTbH2uaWuGVERyC6da9YwGWnzUZXuPro/F2LfsdOsLnCojz/iSH8MxUt/FD2S5XBSVPhmArFUXcpCQ2Hkiw=="],- "@snowplow/browser-tracker": ["@snowplow/[email protected]", "", { "dependencies": { "@snowplow/browser-tracker-core": "3.2.0", "@snowplow/tracker-core": "3.2.0", "tslib": "^2.3.0" } }, "sha512-k9oabjXpM7qIYM5CnMu1EZ/CbbffBKBK1TJTMJaf2k1F3Xplbyqx9DssN1NzgX+lH9Gc22n+yow+czRyppZOCg=="],+ "@snowplow/browser-tracker": ["@snowplow/[email protected]", "", { "dependencies": { "@snowplow/browser-tracker-core": "4.10.2", "@snowplow/tracker-core": "4.10.2", "tslib": "^2.3.1" } }, "sha512-nDX0I2n7AUeTL9H1aI3FDBUkFo8DZIJ7Bp1g8ne7KBCcstrkxADpo7COz9iBOIXNDnr2scEy0ia/eKmRkaZFsA=="],- "@snowplow/browser-tracker-core": ["@snowplow/[email protected]", "", { "dependencies": { "@snowplow/tracker-core": "3.2.0", "sha1": "^1.1.1", "tslib": "^2.3.0", "uuid": "^3.4.0" } }, "sha512-20mrp4OtyzXJMrvDjDmiddKnDUjccg3jOzmK/sNIv8jwPNleHct/MTV1dBo8aTkzxR2jcwL55AqnrD4XIQYDVg=="],+ "@snowplow/browser-tracker-core": ["@snowplow/[email protected]", "", { "dependencies": { "@snowplow/tracker-core": "4.10.2", "tslib": "^2.3.1", "uuid": "^11.1.1" } }, "sha512-KX5Zu+IzslpQW7qVFKzTXupHoHgiz4UWA8A5KujcULrSm2vmDhYJGOtN0SVAOqc0TAB+xLmT9eoeDhSd+oSkKg=="],- "@snowplow/tracker-core": ["@snowplow/[email protected]", "", { "dependencies": { "tslib": "^2.3.0", "uuid": "^3.4.0" } }, "sha512-EsOs8HlWPp3SIFn3TSG5Eo8l/QEU0ZyHVIlvmoQT3fOdsWZVrTK9IlrWi/sA0S43tVxpHKLuiEKgmQIrQXuVyw=="],+ "@snowplow/tracker-core": ["@snowplow/[email protected]", "", { "dependencies": { "tslib": "^2.3.1", "uuid": "^11.1.1" } }, "sha512-L49i7OGAC2qQydnWXmKJnypTyVMqCWwfhKjC8Dk9mDsQn1+yzcHs+B4BxZB+vF0pCOrjPfGMWFmQkND4cWsrGA=="],"@standard-schema/spec": ["@standard-schema/[email protected]", "", {}, "sha512-l2aFy5jALhniG5HgqrD6jXLi/rUWrKvqN/qJx6yoJsgKhblVd+iqqU4RCXavm/jPityDo5TCvKMnpjKnOriy0w=="],@@ -4745,8 +4745,6 @@"sha.js": ["[email protected]", "", { "dependencies": { "inherits": "^2.0.4", "safe-buffer": "^5.2.1", "to-buffer": "^1.2.0" }, "bin": { "sha.js": "bin.js" } }, "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w=="],- "sha1": ["[email protected]", "", { "dependencies": { "charenc": ">= 0.0.1", "crypt": ">= 0.0.1" } }, "sha1-rdqnqTFo85PxnrKxUJFhjicA+Eg="],-"shadow-cljs": ["[email protected]", "", { "dependencies": { "buffer": "^6.0.3", "process": "^0.11.10", "readline-sync": "^1.4.10", "shadow-cljs-jar": "1.3.4", "source-map-support": "^0.5.21", "which": "^5.0.0", "ws": "^8.18.1" }, "bin": { "shadow-cljs": "cli/runner.js" } }, "sha512-t5TBJmy77abwlkAY7UOXa1s9H/28nTHeDVckgzEVS8ONYtDvbNCHEuBYfS7wwV9wVZVybRNb7dILWNXISJL1Nw=="],"shadow-cljs-jar": ["[email protected]", "", {}, "sha512-cZB2pzVXBnhpJ6PQdsjO+j/MksR28mv4QD/hP/2y1fsIa9Z9RutYgh3N34FZ8Ktl4puAXaIGlct+gMCJ5BmwmA=="],@@ -5595,11 +5593,11 @@"@snowplow/browser-tracker-core/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],- "@snowplow/browser-tracker-core/uuid": ["[email protected]", "", { "bin": { "uuid": "./bin/uuid" } }, "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="],+ "@snowplow/browser-tracker-core/uuid": ["[email protected]", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ=="],"@snowplow/tracker-core/tslib": ["[email protected]", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],- "@snowplow/tracker-core/uuid": ["[email protected]", "", { "bin": { "uuid": "./bin/uuid" } }, "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="],+ "@snowplow/tracker-core/uuid": ["[email protected]", "", { "bin": { "uuid": "dist/esm/bin/uuid" } }, "sha512-vIYxrBCC/N/K+Js3qSN88go7kIfNPssr/hHCesKCQNAjmgvYS2oqr69kIufEG+O4+PfezOH4EbIeHCfFov8ZgQ=="],"@storybook/addon-docs/react": ["[email protected]", "", { "dependencies": { "loose-envify": "^1.1.0" } }, "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ=="],diff --git a/e2e/test-component/scenarios/embedding-sdk/analytics-component-events.cy.spec.tsx b/e2e/test-component/scenarios/embedding-sdk/analytics-component-events.cy.spec.tsxindex 964cb25983b..83a9f0c13f3 100644--- a/e2e/test-component/scenarios/embedding-sdk/analytics-component-events.cy.spec.tsx+++ b/e2e/test-component/scenarios/embedding-sdk/analytics-component-events.cy.spec.tsx@@ -84,7 +84,7 @@ describe("scenarios > embedding-sdk > analytics — per-mount component events",});// Capture every POST to the proxy into a closure array so we can assert across- // the several immediate (bufferSize: 1) posts a single mount produces.+ // the one or more posts a single mount produces.const interceptAnalyticsProxy = () => {const capturedEvents: SdkEventData[] = [];cy.intercept("POST", "/api/analytics-proxy", (request) => {@@ -108,10 +108,9 @@ describe("scenarios > embedding-sdk > analytics — per-mount component events",cy.findByText("Product ID").should("be.visible");});- // Beacon and component event are serialized by Snowplow's executingQueue:- // event 2 is only sent after event 1's XHR response arrives, so they come- // in two separate requests. Wait for both before asserting.- cy.wait(["@analyticsProxy", "@analyticsProxy"]);+ // Snowplow v4 batches same-tick events into one POST, so both events may share a request.+ // Wait for the first request; the retrying assertions below cover the rest.+ cy.wait("@analyticsProxy");cy.wrap(capturedEvents).should((events: SdkEventData[]) => {const componentEvent = findEventByComponent(events, "StaticQuestion");@@ -208,8 +207,8 @@ describe("scenarios > embedding-sdk > analytics — per-mount component events",});// beacon already fired in test 1 (once per JS context);- // InteractiveQuestion + CollectionBrowser = 2 component events- cy.wait(["@analyticsProxy", "@analyticsProxy"]);+ // InteractiveQuestion + CollectionBrowser = 2 component events, possibly in one POST+ cy.wait("@analyticsProxy");cy.wrap(capturedEvents).should((events: SdkEventData[]) => {const interactiveQuestionEvent = findEventByComponent(diff --git a/frontend/src/embedding-sdk-bundle/analytics/snowplow.ts b/frontend/src/embedding-sdk-bundle/analytics/snowplow.tsindex e47acce8a7b..158be39b086 100644--- a/frontend/src/embedding-sdk-bundle/analytics/snowplow.ts+++ b/frontend/src/embedding-sdk-bundle/analytics/snowplow.ts@@ -81,19 +81,20 @@ export function initSdkTracker({platform: "web",eventMethod: "post",contexts: { webPage: true },- // Plain JSON on the wire. The main-app tracker uses the default (encodeBase64:true);+ // Plain JSON on the wire. The main-app tracker keeps base64 on;// the SDK tracker is new, so there's no legacy format to preserve.encodeBase64: false,// Deliver through the instance proxy, not the collector's tp2 path.postPath: "/api/analytics-proxy",// No cookies / localStorage: the SDK must not touch the host page's storage.- // This also makes cookie-domain config (e.g. discoverRootDomain) irrelevant.stateStorageStrategy: "none",+ // v4 defaults this to true, and the test-cookie probe ignores stateStorageStrategy.+ discoverRootDomain: false,// Server-side anonymisation: strip IP + network_userid, send the SP-Anonymous header.anonymousTracking: { withServerAnonymisation: true },// The proxy endpoint uses `Access-Control-Allow-Origin: *`. Wildcard CORS rejects// credentialed requests, so credentials must be omitted.- withCredentials: false,+ credentials: "omit",plugins: [createSdkInstanceContextPlugin(store)],});return true;diff --git a/frontend/src/embedding-sdk-bundle/analytics/snowplow.unit.spec.ts b/frontend/src/embedding-sdk-bundle/analytics/snowplow.unit.spec.tsindex 0ac73a4d4f8..5c3162f1a1c 100644--- a/frontend/src/embedding-sdk-bundle/analytics/snowplow.unit.spec.ts+++ b/frontend/src/embedding-sdk-bundle/analytics/snowplow.unit.spec.ts@@ -53,8 +53,8 @@ describe("embedding-sdk-bundle/analytics/snowplow (CSP transport)", () => {describe("initSdkTracker", () => {// Assert only the flags whose absence fails silently in a customer's prod app:// proxy path (CSP), server anonymisation (privacy), and no host-page storage.- // CORS: 3.1.6 hardcoded withCredentials=true with no config option; 3.2.0 added- // withCredentials as a config, so we pin it false to satisfy wildcard CORS on the proxy.+ // CORS: v4 sends credentials by default, so we omit them to satisfy wildcard CORS on the proxy.+ // Storage: v4 probes the root domain with a test cookie unless told not to.// The rest is cosmetic config, not a safety contract.it("configures the proxy path, anonymises, and touches no storage", async () => {const { initSdkTracker } = await loadModule();@@ -75,7 +75,8 @@ describe("embedding-sdk-bundle/analytics/snowplow (CSP transport)", () => {postPath: "/api/analytics-proxy",stateStorageStrategy: "none",anonymousTracking: { withServerAnonymisation: true },- withCredentials: false,+ discoverRootDomain: false,+ credentials: "omit",}),);});diff --git a/frontend/src/metabase/analytics/event.ts b/frontend/src/metabase/analytics/event.tsindex 02958d7e674..3c64f9ecc1d 100644--- a/frontend/src/metabase/analytics/event.ts+++ b/frontend/src/metabase/analytics/event.ts@@ -64,15 +64,11 @@ export function trackSchemaEvent<S extends SchemaType>(}if (shouldSendSnowplow) {- Snowplow.trackSelfDescribingEvent(- {- event: {- schema: `iglu:com.metabase/${schema}/jsonschema/${VERSIONS[schema]}`,- data: event,- },- },- ["sp"],- );+ const payload: Snowplow.SelfDescribingJson = {+ schema: `iglu:com.metabase/${schema}/jsonschema/${VERSIONS[schema]}`,+ data: event,+ };+ Snowplow.trackSelfDescribingEvent({ event: payload }, ["sp"]);}if (Settings.get("metaplow-tracking-enabled")) {diff --git a/frontend/src/metabase/analytics/snowplow.ts b/frontend/src/metabase/analytics/snowplow.tsindex a1e1026edcc..5d4b6c74b17 100644--- a/frontend/src/metabase/analytics/snowplow.ts+++ b/frontend/src/metabase/analytics/snowplow.ts@@ -13,6 +13,8 @@ export const createSnowplowTracker = (getUserId: GetUserId): void => {appId: "metabase",platform: "web",eventMethod: "post",+ // Keep the v3 wire format; v4 defaults to plain JSON for POST.+ encodeBase64: true,discoverRootDomain: true,contexts: { webPage: true },anonymousTracking: { withServerAnonymisation: true },diff --git a/package.json b/package.jsonindex 815533abfa7..bf19fe9e259 100644--- a/package.json+++ b/package.json@@ -51,7 +51,7 @@"@modelcontextprotocol/ext-apps": "^1.3.2","@react-oauth/google": "^0.11.1","@reduxjs/toolkit": "^2.12.0",- "@snowplow/browser-tracker": "3.2.0",+ "@snowplow/browser-tracker": "4.10.2","@tanstack/react-table": "^8.21.3","@tanstack/react-virtual": "^3.13.2","@tiptap/core": "^3.31.3",