[UA] 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.

 
 

Custom Configurations

If you don't want to import our configuration file for collecting client ID in a custom dimension, there's also many other methods for collecting this data. The key when putting together your own configuration for collecting client ID is to pull it from the _ga cookie that Analytics uses to write and store this cookie. The developer center gets into this topic in a little bit more technical detail.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
17152992029676835384
true
Search Help Center
true
true
true
true
true
69256
false
false