: Custom variable in Google analytics not capturing data from Django site? I'm making a website in Python Django and I'd like to add my a custom variable (dimension with user level scope) to
I'm making a website in Python Django and I'd like to add my a custom variable (dimension with user level scope) to my Google Analytics. So, I created directions in creating one from this GA instructions page, yet my custom variable is not being tracked in my dashboard. I can see it in Reporting > Audience > Custom > Custom variables. The dimension is available for me to add as a secondary dimension (although strangely not as primary dimension - or is it auto selected because I have just one custom variable and the primary dimension in the table is auto selected as 'Custom Variable (Key 1)'?)
Why am I not getting any data for my custom variable? I'm supposed to be getting the registered user's email. I've tried user.email and user.user.email and one of them should've worked for my site, but neither are capturing data. I can see the traffic being recording in real time as I reload a page, so code is fine, hits are being sent and recorded. Is my custom variable wrong? Did I overlook something in defining it? Or is there some 24 hour window for me to see custom variable data?
It's my first time, help much appreciated!!
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXXXXX-1', 'auto');
var dimensionValue = "{{ user.email }}";
ga('set', 'dimension1', dimensionValue);
ga('send', 'pageview');
My custom variable definition:
My Reporting dashboard allows me to select user_email as secondary dimension, but shows no data.
More posts by @Shanna517
1 Comments
Sorted by latest first Latest Oldest Best
Your screenshot shows the report for Google Analytics custom variables, however your code is for custom dimensions.
Custom variables where a feature in the previous incarnation of Google Analytics, tracked via the now deprecated ga.js library. They had their own report in the GA interface which is still present, since the interface is a "one-size-fits-all" kind of thing and if you have custom variables that you have collected in the past you still want to be able to access them.
Custom dimensions are supported by Universal Analytics, the current version of GA. They have taken the place of custom variables, which are no longer supported by the tracking code.
You can completely ignore the "Custom" menu item in the GA interface - the only people who need that are people who want to look at custom variables they collected with legacy code.
Custom dimensions do not have their own report, you can select them as secondary dimensions in your standard reports or create custom reports with a custom dimension as primary dimension (and you can use them for segmentation).
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.