From b68ab76af2b7afdf1c9482ef84f400a695f3a6d3 Mon Sep 17 00:00:00 2001 From: Stefan Hauke Date: Fri, 12 Jan 2024 18:18:03 +0100 Subject: [PATCH] docs: improve Google Tag Manager integration documentation --- docs/concepts/authentication.md | 8 ++++---- docs/guides/google-tag-manager.md | 34 +++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/docs/concepts/authentication.md b/docs/concepts/authentication.md index 03eb686410..66a6a9ccfb 100644 --- a/docs/concepts/authentication.md +++ b/docs/concepts/authentication.md @@ -54,10 +54,10 @@ To add or change the functionality of an identity provider, the following steps } ``` - > [!NOTE] - > If an identity provider is using the OAuthService for authentication, the identity provider have to inject the OAuthService with a new instance. - > Otherwise, difficult side effects with the [TokenService](../../src/app/core/services/token/token.service.ts) will occur. - > Please checkout the [Auth0IdentityProvider](../../src/app/core/identity-provider/auth0.identity-provider.ts) for an example. +> [!NOTE] +> If an identity provider is using the OAuthService for authentication, the identity provider have to inject the OAuthService with a new instance. +> Otherwise, difficult side effects with the [TokenService](../../src/app/core/services/token/token.service.ts) will occur. +> Please checkout the [Auth0IdentityProvider](../../src/app/core/identity-provider/auth0.identity-provider.ts) for an example. 2. Register the `.identity-provider.ts` in the [`IdentityProviderModule`](../../src/app/core/identity-provider.module.ts). The `APP_INITIALIZER` injection token is used to configure and initialize the identity provider before app initialization. diff --git a/docs/guides/google-tag-manager.md b/docs/guides/google-tag-manager.md index a6b4e33cea..593b12eee9 100644 --- a/docs/guides/google-tag-manager.md +++ b/docs/guides/google-tag-manager.md @@ -9,11 +9,41 @@ kb_sync_latest_only To enable user tracking and setting it up with [Google Tag Manager](https://github.com/angulartics/angulartics2/tree/master/src/lib/providers/gtm), the popular library [Angulartics2](https://angulartics.github.io/angulartics2/) is used. +> [!NOTE] +> The standard Intershop PWA Google Tag Manager integration is very basic and currently only supports the tracking of route changes. +> +> Please refer to the [angulartics2 documentation](https://github.com/angulartics/angulartics2#usage) for information on how to enable tracking for additional events (e.g. ecommerce events). + To activate GTM tracking, set the Tag Manager Token either in the used Angular CLI environment file with the property `gtmToken` or via the environment variable `GTM_TOKEN`. Additionally, the feature toggle `tracking` has to be added to the enabled feature list. This feature only works in Universal Rendering mode. Prefer configuration via system environment variables. -Please refer to the [angulartics2 documentation](https://github.com/angulartics/angulartics2#usage) for information on how to enable tracking for additional events. +Example via `environment.ts` file: + +```typescript +features: ['tracking'], +gtmToken: 'GTM-ABCDEFG', +``` + +Example via `docker-compose.yml` configuration: + +```yaml +pwa: + environment: + - FEATURES=tracking + - GTM_TOKEN=GTM-ABCDEFG +``` + +Example via PWA Helm Chart: + +```yaml +environment: + - name: FEATURES + value: tracking + - name: GTM_TOKEN + value: GTM-ABCDEFG +``` -For GDPR compliance the tracked IPs have to be anonymized. +> [!IMPORTANT] +> For GDPR compliance the tracked IPs have to be anonymized, see [How to turn on IP anonymization in Google Analytics and Google Tag Manager](https://www.optimizesmart.com/how-to-turn-on-ip-anonymization-in-google-analytics-and-google-tag-manager/).