To enable click-level data extraction from Google Analytics (GA) you must track unique User IDs in a custom dimension. You can do so with Google Tag Manager in the following way.
Prerequisite: Only Universal Analytics ("analytics.js”) is supported at the moment (not “ga.js”). This guide does not cover mobile apps tracking.
Part 1/3: Create a custom dimension in Google Analytics
- Sign in to Google Analytics
- Click Admin
- Select your Account and Property
- Expand Custom Definitions and click Custom Dimensions:
- Click +NEW CUSTOM DIMENSION
- Enter scitylana in the Name textbox and select Hit scope:
- Click Create
- Write down/note the Index value of the new scitylana custom dimension. This is a number between 1-20 in the free edition of GA or 1-200 in Premium.
Part 2/3: Create the SCITYLANA custom JavaScript variable in Google Tag Manager
- Sign in to Google Tag Manager
- Select the container of your site
- Click on Variables in the menu on you left-hand side.
- Click on the NEW button
- Click Untitled Variable and rename to scitylana
- Click Variable Configuration
- Click on Custom JavaScript
- Follow this link and copy all the text (e.g. press CTRL + A then CTRL + C)
- Paste the text into the textbox. (e.g. use CTRL + V)
- Change the text UA-XXXXXXXX-Y to your tracker ID (for the experienced GTM user, you can use a constant using the bracket notation {{constant}} )
- Click SAVE
Part 3/3: Add the scitylana variable to all the Universal Analytics tags.
- Click Tags from the left menu
- Sort your tags by clicking on Type:
- Scroll down to the section where the Type column reads Universal Analytics (UA):
- Click on the tag you will edit (you must repeat this process for all the Universal Analytics tags)
- Click on Tag Configuration
- If Enable overriding settings in this tag is set then continue. (*
- Expand More settings
- Expand Custom Dimensions
- Click +ADD CUSTOM DIMENSION
- In the first field (index) insert index value from Part 1/3
- In the second field Dimension Value write {{scitylana}}
- Click SAVE (upper-right corner)
- Repeat steps 5-12 for all the tags named Universal Analytics under Type.
- Select Preview and debug and check you have no script errors on your site
- Select Publish
(* If you use a Google Analytics Settings variable in GTM, set the custom dimension there and skip the rest of the guide.