Mobile app version of vmapp.org
Login or Join
Heady270

: Track user through Google Universal Analytics I want to track a user from my site, give an id to Google Analytics and later be able to see which pages that id visited and for how long did

@Heady270

Posted in: #Analytics #CustomVariables #Google #GoogleAnalytics

I want to track a user from my site, give an id to Google Analytics and later be able to see which pages that id visited and for how long did that id view the pages.

I've tried custom variables with the classic analytics.

I tried enabling the User-ID feature in the Universal Analytics.

Neither of these have given me what I want yet. Is there any way to accomplish this with Universal Analytics?

UPDATE

This is a sample code with a user whose id is 2. I try to set the userid in different ways to see if at least in one way it shows.

<script>
(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');

ga('create', 'UA-XXXXXXX-1', 'domain.com', { 'userId': '2' });

ga('set', '&uid', '2'); // Set the user ID using signed-in user_id.

var dimensionValue = '2';
ga('set', 'dimension1', dimensionValue);

ga('send', 'pageview');

</script>

10% popularity Vote Up Vote Down


Login to follow query

More posts by @Heady270

0 Comments

Sorted by latest first Latest Oldest Best

Back to top | Use Dark Theme