'Implementing User-ID With Google Tag Manager
I have added Google Tag Manager to our site, and using the data layer inserted several custom dimensions, including 'user_id' Data Layer with user_id shown
The Google Analytics variable in Tag Manager is configured to pass these data layer variables into the coresponding dimensions: Tag Manager Variable & Dimensions in Analytics
I know this is working as I am able to add this as a secondary dimension in Analytics when viewing reports: Analytics with Dimension Shown
However, the user view that is created when I have set up the User-Id isnt showing anything: Creating the User View
We installed Tag Manager using the recommended steps: Installation of Tag Manager
Do we also need to add the 'Global Site Tag Tracking Code'? How to Implement the User-ID in your tracking code
If not, what am I doing wrong?
Solution 1:[1]
You're actually REALLY close. You actually don't need to create the custom dimension.
The correct way is to set the userId field in your GA tag (I did it through a GA variable so it is applied everywhere).
Solution 2:[2]
Yes, that is exactly correct (what @XTOTHEL answered above), but for those who are reading this, I found these two blog posts helpful (esp if you are using GTM):
- GA UA: https://www.analyticsmania.com/post/google-analytics-user-id-with-google-tag-manager/
- GA4: https://www.analyticsmania.com/post/google-analytics-4-user-id/
And of course, the GA docs: https://support.google.com/tagmanager/answer/4565987?hl=en
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | XTOTHEL |
| Solution 2 | Benjamin Hoffman |

