Capture the GA Client ID in a Custom Dimension

Overview

The GTM Client ID Tracking container includes support for capturing the GA client ID value and passing it to GA using non-interactive events.

Container highlights

  • Tags
    • Universal Analytics non-interactive tracking event
  • Triggers
    • Window loaded with valid Client ID
  • Variables
    • GA Property
    • GA Client ID custom dimension index
    • GA Client ID

Follow the steps below to deploy the GTM Client ID Tracking configuration container. This article assumes that you have created your own GTM account and container.

Download the Client ID Tracking configuration file

Download the GTM Client ID Tracking configuration file.

Import container configuration file

Import the container file into your Tag Manager container. If your Tag Manager container already has existing configurations, you can opt to merge the import into your existing container -- if so, you should remove any duplicate Analytics tags from your existing container.

Adjust Tag Manager container variables

The following variables have been provided in the Tag Manager configuration file and require personalized adjustment. You will find them in your container with names preceded by 0_, 1_, or 2_. It is recommended that you rename them without this prefix once you have edited them.

Analytics settings

Ensure that the settings variable used in the configuration file is compatible with any settings used by your existing container.

Analytics property

It is required to place your Google Analytics property id into the 0_GA property constant variable with the Tag Manager container.

GA index - cd - client ID

To implement GA client id tracking in a custom dimension, modify the GTM variable, 1_GA index - cd - client ID  with the index of your client Id custom dimension.

If this dimension does not exist, you must create it as a user-scoped custom dimension

 

Test & Publish

Test the container (preferably on a non-production environment) to ensure that it functions as expected and does not impact any of your site's functionality (it is recommended to use the Chrome extension for tag injection for testing containers).

Publish the container to see the changes go live.

Was this helpful?
How can we improve it?