Google Analytics Custom dimension doesnt work

kurosaki4d

Power Member
Joined
Apr 24, 2018
Messages
694
Reaction score
83
Hello,


I'm having some troubles with the custom dimension that i set in my file's header. The analytics is linked to my site because i get on the analytics the real time count.

That been said, as you can see in the code there is a JS variable iduser it contains the value of a div that has the current ID of the user connected.

I created the dimension based on Hit so i make some interactions in my page but i don't get the value of userid in my custom reports

I was wondering if some of you can help and tell me where my set up is wrong ?


NOTE: The name of the dimension in my GA is : dimension1


Thank you so much in advance


(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','//www.google-analytics.com/analytics.js','ga');

iduser = $('#userid').text();

ga('create', 'UA-xxxxxxxxxxx', 'auto');
ga('set','dimension1', iduser);
ga('send', 'pageview');
 
Back
Top