diff --git a/apps/acf-extension/src/background/index.ts b/apps/acf-extension/src/background/index.ts index 0ead64e9..5ff45fe8 100644 --- a/apps/acf-extension/src/background/index.ts +++ b/apps/acf-extension/src/background/index.ts @@ -77,6 +77,13 @@ try { }; Runtime.onMessageExternal(onMessageListener); Runtime.onMessage(onMessageListener); + + auth.authStateReady().then(() => { + const clientId = auth.currentUser?.uid; + if (clientId) { + chrome.storage.local.set({ clientId }); + } + }); } catch (error) { if (error instanceof Error) { googleAnalytics?.fireErrorEvent({ name: error.name, error: error.message, additionalParams: { page: 'background' } }); diff --git a/libs/shared/google-analytics/src/lib/google-analytics-background.ts b/libs/shared/google-analytics/src/lib/google-analytics-background.ts index df427462..28599393 100644 --- a/libs/shared/google-analytics/src/lib/google-analytics-background.ts +++ b/libs/shared/google-analytics/src/lib/google-analytics-background.ts @@ -5,8 +5,8 @@ import { FireErrorEventParams, FireEventParams, FirePageViewEventParams } from ' export class GoogleAnalyticsBackground { debug: boolean; constructor( - private MEASUREMENT_ID?: string, - private API_SECRET?: string, + private readonly MEASUREMENT_ID?: string, + private readonly API_SECRET?: string, debug = false ) { this.MEASUREMENT_ID = MEASUREMENT_ID;