.Stat Suite documentation

Google Tag Manager

Table of Content

Version history:
Migrating from UA to GA4 property with July 20, 2023 Release .Stat Suite JS Virtual
Released in October 5, 2021 Release .Stat Suite JS 10.0.0
Read the disclaimers for a better understanding of the historical implementations of Google Analytics and Google Tag Manager in .Stat Suite.

GTM logo

How to configure Google Tag Manager

These are the steps to follow in order to properly configure Google Tag Manager (GTM).


  • GTM account Create an account in GTM. This account will allow you to create containers enabling to send data to analytics tools (e.g. Google Analytics).

Create GTM containers

What is a container?
A container is a collection of tags, triggers, variables, and related configurations installed on a given website or mobile app.

We have chosen to create one container per service for a better maintainability and for further potential evolutions of the scope (e.g. new events to track requiring to include another .Stat Suite service).
Hence, you need to create two containers, one for data-explorer and one for data-viewer.

GTM - create a container

You can name each container “data-explorer” and “data-viewer”, or add a notion of env. (e.g. “data-explorer-qa”) if you plan to setup GTM on different instances for test purposes. Each container is automatically created with a Container ID.

Container IDs in the deployment process

In order to allow GTM retrieving tags from an instance of .Stat Data Explorer and .Stat Data Viewer, you need to provide each respective Container ID in your deployment process as an env variable named GTM_TOKEN in the scope of the compliant service (data-explorer and data-viewer). You can add the env variable in your .env file and start data-explorer and data-viewer services.
If you are using Docker Compose, you have to declare the env variable in the compose file (see example)

Example with Docker .env:

# ---------------------------------------- Analytics

GTM - container ID

Retrieve the containers default settings

The settings of the containers are configurations in .json files already prepared and maintained by our developers, and required in the next steps of GTM setup. They contain all specific tags, triggers and variables created in advance for tracking data explorer and data viewers’ usages and statistics.

Download the two following .json files:

Note that it is also possible to change, for compatibility with a previous version of your usage of GTM or GA, or for business reasons, to modify the names and definitions of these tags, triggers and variables before importing them into the containers.

Import the containers settings

After having downloaded the pre-configured containers settings, you now need to import it into GTM.
Select your container and select the ‘Admin’ tab. In the Container options menu, select “Import Container”:

GTM - create a container

Select the respective .json file previously downloaded to import and that matches the GTM container (data-explorer or data-viewer).
Choose your workspace (Default workspace, if it is the first time your create a container), and choose the import option between “Overwrite” or “Merge” (Overwrite, if it is the first your create a container).

GTM - create a container next step

Repeat these steps for both data-explorer and data-viewer containers.

Configure the containers

In order to properly setup and complete your containers’ configurations, you need to add your domain and a Google Analytics Token.

Configure your domains

From the “Workspace” of your data-explorer container, go to “Variables”, then click on the “Domain” user-defined variable.

GTM - configure your domain

Keep the Variable type as “Constant”, and change the Value to your domain URL (e.g., https://de-qa.siscc.org/).
Repeat the same steps in the data-viewer container, the Value of your domain being the URL of the Data Viewer (e.g. https://dv-qa.siscc.org).

Configure Google Analytics with Google Tag Manager

Disclamier: Since July 1st 2023, Universal Analytics (UA) standard has stopped processing data in Google Analytics and is being replaced by Google Analytics 4 (GA4) properties (see more).

The “Google Analytics: GA4 configuration” variable, where to define the GA4 Google tag ID, is necessary if you want Google Tag Manager to send data to Google Analytics.


  1. Set up a Google Analytics account (see how to)
  2. Define and retrieve your GA4 Google tag ID (see how to)

From the “Workspace” of your data-explorer container, go to “Tags”, then click on “New”, select “Tag Configuration” and then “Google Analytics: GA4 Configuration”.

GTM - configure your GA4 ID

Copy your GA4 Google tag ID in the “Measurement ID” field.

GTM - configure your GA4 ID

Click on the “Triggering” area below, and select “All Pages”, then save.

GTM - configure your GA4 ID

Repeat the same steps in your data-viewer container.

Configure your cross domains

The Cross-domain variable is necessary if you want to track events when a user clicks on a hyperlink from your website to another target (outbound links).

From the “Workspace” of your data-explorer container, go to “Variables”, then click on the “Cross-domain” user-defined variable.

GTM - configure your domain

Keep “Variable Type” to “Element URL”, “Component Type” to “Is Outbound”, and then change “Affiliated Domains” value by the comma-separated list your cross-domain hyperlink, then save.

GTM - configure your domain next step

Add optional static data inside your dataLayer

You can add custom static values inside your dataLayer (optional), in order to send additional events to be trakced by GTM.


in dotstatsuite-config-data/<env>/configs/<tenant>/data-explorer/settings.json under a key entry named "analytics"

  "analytics": {
    "dataLayer": {
      "is_global": "yes",
      "is_directorates": "no",
      "is_satellite": "no",
      "template_name": "data explorer"

Events tags and triggers

All events in GTM are listed under the Tags tab of the Workspace. Each tag is defined by a name and a one or several Triggers.

  • data-explorer Tags

GTM - data-explorer Tags

  • data-viewer Tags

GTM - data-viewer Tags

Another useful detailed view of GTM tags is the list of triggers under the Triggers tab. Triggers names should be enough self-explenatory for the user to understand what action it refers to in the DE for example: “Browse by”, “Download Excel”, etc.

  • data-explorer Triggers

GTM - data-explorer Triggers

  • data-viewer Triggers

GTM - data-viewer Triggers

Example of a Google Analytics monitoring dashboard

to be completed