: GTAG User ID tracking not working I've turned on User ID tracking, and am using the following code: window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js',
I've turned on User ID tracking, and am using the following code:
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<UA-ID>');
//gtag('config', '<UA-ID>', {'user_id': '{% user_display request.user %}'});
// developers.google.com/analytics/devguides/collection/gtagjs/setting-values gtag('set', {'user_id': '{% user_display request.user %}'}); // Set the user ID using signed-in user_id.
I've confirmed that the user_id value is being properly set by the JS. Also, I am able to see tracking info, except that it is NOT attached to a user.
Wondering if anyone has set this up before and could help debug. Also, note that I am using GTAG not the older Analytics (which I believe is called UA - Universal Analytics).
More posts by @Courtney195
1 Comments
Sorted by latest first Latest Oldest Best
I figured this out, User ID has to be set before the pageview event is sent. Maybe just after the function gtag() declaration would help.
I switched over to the older analytics.js since it is much better supported. The same applies there as well.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.