diff --git a/plugins/analytics-module-ga4/README.md b/plugins/analytics-module-ga4/README.md index 93138a8235..2d8c930e30 100644 --- a/plugins/analytics-module-ga4/README.md +++ b/plugins/analytics-module-ga4/README.md @@ -87,6 +87,7 @@ Additional dimensional data can be captured using custom dimensions, like this: attribute names will be prefixed by `a_`. 5. `allowedContexts` and `allowedAttributes` are optional, if not provided, no additional context and attributes will be sent. 6. if `allowedContexts` or `allowedAttributes` is set to '\*', all context and attributes will be sent. +7. `enableSendPageView` is used to send default events and is disabled by default. ```yaml app: diff --git a/plugins/analytics-module-ga4/src/apis/implementations/AnalyticsApi/GoogleAnalytics4.ts b/plugins/analytics-module-ga4/src/apis/implementations/AnalyticsApi/GoogleAnalytics4.ts index fb5bd261da..9abf4719c6 100644 --- a/plugins/analytics-module-ga4/src/apis/implementations/AnalyticsApi/GoogleAnalytics4.ts +++ b/plugins/analytics-module-ga4/src/apis/implementations/AnalyticsApi/GoogleAnalytics4.ts @@ -47,6 +47,7 @@ export class GoogleAnalytics4 implements AnalyticsApi { measurementId: string; testMode: boolean; debug: boolean; + enableSendPageView: boolean; contentGroupBy?: string; allowedContexts?: string[]; allowedAttributes?: string[]; @@ -58,6 +59,7 @@ export class GoogleAnalytics4 implements AnalyticsApi { userIdTransform = 'sha-256', testMode, debug, + enableSendPageView, contentGroupBy, allowedContexts, allowedAttributes, @@ -70,7 +72,7 @@ export class GoogleAnalytics4 implements AnalyticsApi { }, gtagOptions: { debug_mode: debug, - send_page_view: false, + send_page_view: enableSendPageView, }, }); @@ -113,6 +115,9 @@ export class GoogleAnalytics4 implements AnalyticsApi { const identity = config.getOptionalString('app.analytics.ga4.identity') || 'disabled'; const debug = config.getOptionalBoolean('app.analytics.ga4.debug') ?? false; + const enableSendPageView = + config.getOptionalBoolean('app.analytics.ga4.enableSendPageView') ?? + false; const testMode = config.getOptionalBoolean('app.analytics.ga4.testMode') ?? false; @@ -139,6 +144,7 @@ export class GoogleAnalytics4 implements AnalyticsApi { measurementId: measurementId, testMode, debug, + enableSendPageView, contentGroupBy, allowedContexts, allowedAttributes,