Skip to content

Commit

Permalink
docs: improve Google Tag Manager integration documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
shauke committed Jan 12, 2024
1 parent 374ec79 commit b68ab76
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 6 deletions.
8 changes: 4 additions & 4 deletions docs/concepts/authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<idp>.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.

Expand Down
34 changes: 32 additions & 2 deletions docs/guides/google-tag-manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/).

0 comments on commit b68ab76

Please sign in to comment.