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.