send_page_view changed to configurable

Signed-off-by: elena.krasnopolskaia <elena.krasnopolskaia@semrush.com>
This commit is contained in:
elena.krasnopolskaia
2023-12-06 15:15:03 +01:00
parent af6f227973
commit e3c035b7e6
2 changed files with 8 additions and 1 deletions
+1
View File
@@ -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:
@@ -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,