: 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
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>
More posts by @Heady270
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.