chameleon-system-private/google-tag-manager-bundle

8.0.45 2025-05-05 13:57 UTC

README

Bundle adds the base implementation to track data to Google Tag Manager.

Setup

Follow this step by step guide to set up GoogleTagManagerBundle.

Prerequisites

Bundle requires a Google account and a GoogleTagManager account. Sign in at https://tagmanager.google.com to create a GoogleTagManager account. Within this account you can add different tracking tags, for example for GoogleAnalytics or Bing.

Install Bundle

In the projects composer.json, require chameleon-system/google-tag-manager-bundle in the version that matches the Chameleon version used and run composer update.

Add ChameleonSystem\GoogleTagManagerBundle\ChameleonSystemGoogleTagManagerBundle() to the AppKernel.

Run CMS updates.

Configuration

Insert your GoogleTagManager Container-ID to external tracker "Google Tag Manager" and activate it. For each page in the CMS you can define a special page type which was sent as value for the variable 'pageType'. You can see all possible values in the field "description" in the CMS.

Add/Modify Tracking Data

If you want to add or modify the tracking data sent to GoogleTagManager, you have to tag your mapper service with the tag 'chameleon_system_google_tag_manager_bundle.google_tag_manager_mapper'.

Tracked Data

The default implementation sends the following data to GoogleTagManager

- language
- pageType
- pageName
- event
- events
    - Login, Registration
        - eventCategory
        - eventAction
        - eventLabel

Use Server Side Tracking

To enable Server Side tracking with the Bundle, you need to configure the SST Domain in you project config. Example:

chameleon_system_google_tag_manager:
  tag_manager_configuration:
    gtm_domain: 'https://sst.myProject.de'
    gtm_script_url: 'init.js'

When no congiguration like this is provided, the default, which is the dtandard gtm implementation is used.