diff --git a/packages/analytics/modules/analytics/providers/google-analytics-4.ts b/packages/analytics/modules/analytics/providers/google-analytics-4.ts index 66931d7ad..183aa8434 100644 --- a/packages/analytics/modules/analytics/providers/google-analytics-4.ts +++ b/packages/analytics/modules/analytics/providers/google-analytics-4.ts @@ -4,6 +4,7 @@ import type { BaseAnalyticsEvent } from '../types'; const DEFAULT_ENGAGEMENT_TIME_IN_MSEC = 100; export interface GoogleAnalytics4ProviderOptions { + apiUrl: string | undefined; apiSecret: string; measurementId: string; } @@ -18,7 +19,7 @@ export const googleAnalytics4 = ): Promise => { const url = new URL( config?.debug ? '/debug/mp/collect' : '/mp/collect', - 'https://www.google-analytics.com', + options?.apiUrl ? options.apiUrl : 'https://www.google-analytics.com', ); if (options.apiSecret) url.searchParams.set('api_secret', options.apiSecret);