Setting up Google Tag Manager for Universal Analytics
Google Tag Manager manages all your website tags. To integrate HCL Commerce with Google Analytics, you must add tags for each store in the Google Tag Manager.
Google Tag Manager acts as a bridge between the React Store and Google Analytics.
- Each property that you define in Google Analytics maps to one Container in Google Tag Manager.
- Each React Store has a corresponding Container defined in Google Tag Manager.
- Each Container provides the following parameters that the React Store uses:
- gtmid
- gtm_auth
- gtm_preview
Prerequisites
You must have a Google Tag Manager account.
Importing parameters for the Reference Store applications
The Reference Store application Google Tag Manager templates contain all the tags, triggers, and variables for the B2B and B2C Reference Store applications.
Complete the following steps to download the template and import it into Google Tag
Manager.
- If you are using version 9.1.4 or version 9.1.5, download ReactReferenceApp_GTM_config.json.
- If you are using version 9.1.6, download IMPORT-GTM-CONTAINER_EmeraldWorkspace.json and IMPORT-GTM-CONTAINER_SapphireWorkspace.json.
- From version 9.1.12 onwards, download IMPORT-GTM-CONTAINER_Emerald and EmeraldMP Workspace and IMPORT-GTM-CONTAINER_Sapphire and SapphireMP Workspace.
- From version 9.1.13 onwards, download IMPORT-GTM-CONTAINER_Emerald and EmeraldMP Workspace and IMPORT-GTM-CONTAINER_Sapphire and SapphireMP Workspace.
- From version 9.1.14 onwards:
- For the Emerald and Sapphire store continue using the version from 9.1.13, it is unchanged.
- For the Ruby and RubyB2B store, use GTM-9.1.14-RubyB2B and GTM-9.1.14-RubyB2C.
- Log into Google Tag Manager and go to the container for the Emerald Reference Store application.
- Go to the Admin tab and click Import Container.
- Upload the template json files into the container. Select Existing workspace > Default workspace and select the Merge option with Overwrite conflicting tags, triggers and variables.
- Go to the Workspace tab > Variables.
- Find Tracking ID and update with the actual Google Analytics Tracking ID (For example, UA-247689403-2).
- Click Submit and then Publish to deploy this configuration on Google Tag Manager.