From edad84bbe0a4ee7e81c1085d2a81814a88f872a6 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Mon, 17 Nov 2025 12:45:24 -0500 Subject: [PATCH 1/3] feat(ui): Disable Amplitude logging Amplitude logging is not very useful for us and spams the console when its blocked from adblockers. Lets disable logging since most of it is not very actionable. Here our the [Amplitude logs in Sentry](https://sentry.sentry.io/explore/logs/?logsFields=timestamp&logsFields=message&logsFields=replay_id&logsQuery=message%3A%EF%80%8DContains%EF%80%8D%22Amplitude%20Logger%22%20%21message%3A%EF%80%8DContains%EF%80%8D%22Load%20failed%22%20%21message%3A%EF%80%8DContains%EF%80%8D%22Failed%20to%20fetch%22%20%21message%3A%EF%80%8DContains%EF%80%8D%22NetworkError%20when%20attempting%20to%20fetch%22&logsSortBys=-timestamp&project=11276&statsPeriod=14d) with the fetch-related logs filtered out. --- static/gsApp/hooks/analyticsInitUser.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/static/gsApp/hooks/analyticsInitUser.tsx b/static/gsApp/hooks/analyticsInitUser.tsx index 61fbe7001ad750..d6929f28567e1f 100644 --- a/static/gsApp/hooks/analyticsInitUser.tsx +++ b/static/gsApp/hooks/analyticsInitUser.tsx @@ -39,6 +39,7 @@ export default function analyticsInitUser(user: User) { } Amplitude.init(amplitudeKey, undefined, { + logLevel: Amplitude.Types.LogLevel.None, minIdLength: 1, attribution: { disabled: false, From 0480c871bd08ad2712eb39cb4d68bc8139c05364 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Mon, 17 Nov 2025 13:27:03 -0500 Subject: [PATCH 2/3] ... not sure where Amplitude is mocked --- static/gsApp/hooks/analyticsInitUser.spec.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/static/gsApp/hooks/analyticsInitUser.spec.tsx b/static/gsApp/hooks/analyticsInitUser.spec.tsx index 90e91d9e1afcaa..41fc6aee84b74e 100644 --- a/static/gsApp/hooks/analyticsInitUser.spec.tsx +++ b/static/gsApp/hooks/analyticsInitUser.spec.tsx @@ -21,6 +21,8 @@ describe('analyticsInitUser', () => { ConfigStore.set('enableAnalytics', true); ConfigStore.set('getsentry.amplitudeApiKey', 'foo'); setWindowLocation('http:/localhost/'); + const {Types} = jest.requireActual('@amplitude/analytics-browser'); + Amplitude.Types = Types; }); afterEach(() => { sessionStorageWrapper.removeItem('marketing_event_recorded'); From ef85e731633fd19d5783fc3939b8923b4915ba00 Mon Sep 17 00:00:00 2001 From: Billy Vong Date: Mon, 17 Nov 2025 14:59:58 -0500 Subject: [PATCH 3/3] add types to amplitude mock --- static/gsApp/__mocks__/@amplitude/analytics-browser.tsx | 1 + static/gsApp/hooks/analyticsInitUser.spec.tsx | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/static/gsApp/__mocks__/@amplitude/analytics-browser.tsx b/static/gsApp/__mocks__/@amplitude/analytics-browser.tsx index f8eb0358c3b639..5d6f23b1357ad7 100644 --- a/static/gsApp/__mocks__/@amplitude/analytics-browser.tsx +++ b/static/gsApp/__mocks__/@amplitude/analytics-browser.tsx @@ -8,5 +8,6 @@ export const identify = jest.fn(); export const init = jest.fn(); export const track = jest.fn(); export const setGroup = jest.fn(); +export const Types = jest.requireActual('@amplitude/analytics-browser').Types; export const _identifyInstance = identifyInstance; diff --git a/static/gsApp/hooks/analyticsInitUser.spec.tsx b/static/gsApp/hooks/analyticsInitUser.spec.tsx index 41fc6aee84b74e..90e91d9e1afcaa 100644 --- a/static/gsApp/hooks/analyticsInitUser.spec.tsx +++ b/static/gsApp/hooks/analyticsInitUser.spec.tsx @@ -21,8 +21,6 @@ describe('analyticsInitUser', () => { ConfigStore.set('enableAnalytics', true); ConfigStore.set('getsentry.amplitudeApiKey', 'foo'); setWindowLocation('http:/localhost/'); - const {Types} = jest.requireActual('@amplitude/analytics-browser'); - Amplitude.Types = Types; }); afterEach(() => { sessionStorageWrapper.removeItem('marketing_event_recorded');