From b305252a70956291d534d7cc711df8074500016a Mon Sep 17 00:00:00 2001 From: Ritchie Martori Date: Thu, 26 Sep 2024 19:24:38 -0700 Subject: [PATCH] fix url tracking --- app/packages/analytics/src/analytics.test.ts | 4 ++-- app/packages/analytics/src/usingAnalytics.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/packages/analytics/src/analytics.test.ts b/app/packages/analytics/src/analytics.test.ts index 0520bf5585..9a29014374 100644 --- a/app/packages/analytics/src/analytics.test.ts +++ b/app/packages/analytics/src/analytics.test.ts @@ -151,7 +151,7 @@ describe("Analytics", () => { // segment should be called with context.page.url = undefined expect(mockSegment.track).toHaveBeenCalledWith("custom_event", undefined, { context: { - page: { url: undefined }, + page: { url: null, path: null, title: null }, }, }); }); @@ -208,7 +208,7 @@ describe("Analytics", () => { version: "1.0.0", }); }); - + describe("analytics.page()", () => { it("should call segment.page()", () => { analytics = new Analytics(); diff --git a/app/packages/analytics/src/usingAnalytics.ts b/app/packages/analytics/src/usingAnalytics.ts index 7c468534dd..9e0ded2031 100644 --- a/app/packages/analytics/src/usingAnalytics.ts +++ b/app/packages/analytics/src/usingAnalytics.ts @@ -123,7 +123,7 @@ export class Analytics { if (!this._segment) return; let opts; if (this._disableUrlTracking) { - opts = { context: { page: { url: undefined } } }; + opts = { context: { page: { url: null, path: null, title: null } } }; } if (this._version) { opts = { ...opts, version: this._version };