HCL Commerce Version 9.1.6.0 or later

Setting up Google Tag Manager for Google Analytics 4

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.

  • For each GA4 event, a trigger and GA4 event are defined.
  • For each GA4 event, a Measurement ID must be specified. We use a variable to set this.

Prerequisites

You must have a Google Tag Manager account.

Note: These steps are provided for you to set up a Google Analytics 4 property alongside your existing Universal Analytics property.

Importing parameters for the Reference Store applications

For the Emerald and Sapphire Reference Store applications, 2 sample Google Tag Manager containers are provided and pre-configured to route the events that are sent by the React store to Google Tag Manager, to Google Analytics. The templates contain the configuration required for both Universal Analytics, and Google Analytics 4.

Complete the following steps to download the templates and import them into Google Tag Manager.
  1. Download IMPORT-GTM-CONTAINER_EmeraldWorkspace.json and IMPORT-GTM-CONTAINER_SapphireWorkspace.json.
  2. HCL Commerce Version 9.1.12.0 or laterFrom version 9.1.12 onwards, download IMPORT-GTM-CONTAINER_Emerald and EmeraldMP Workspace and IMPORT-GTM-CONTAINER_Sapphire and SapphireMP Workspace.
  3. HCL Commerce Version 9.1.13.0 or laterFrom version 9.1.13 onwards, download IMPORT-GTM-CONTAINER_Emerald and EmeraldMP Workspace and IMPORT-GTM-CONTAINER_Sapphire and SapphireMP Workspace.
  4. HCL Commerce Version 9.1.14.0 or laterFrom version 9.1.14 onwards:
  5. Log into Google Tag Manager and go to the container for the Emerald Reference Store application.
  6. Go to the Admin tab and click Import Container.
  7. 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.
  8. Go to the Workspace tab > Variables.
  9. Find Measurement ID and update with the actual Google Analytics Measurement ID (For example, G-P0RKSXQB2D) from your data stream.
  10. Click Submit and then Publish to deploy this configuration on Google Tag Manager.
Note: After upgrading from one version to another version of HCL Commerce, the specified JSON file should also be changed. For example, if you are upgrading from HCL Commerce version 9.1.11 to 9.1.14, then the JSON files should be replaced with the files suggested in Step 4.