1

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>
  • Are you sure that you have changed to Universal Analytics? If you want to track the navigational style of a particular user you need to include the User ID, Google gives a clear guide, but you need to understand the ip address which you going to include to make the User ID works successfully. Sometimes after inclusion it would take couple of days to show up, provide me with some screenshots of your universal account then will know where you have gone wrong. – Cherrubin of Travel Center UK Jun 11 '14 at 12:17
  • I put my code on the question – raygo Jun 12 '14 at 18:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.