Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics Real-Time not showing results

The following script is not generating activity when cross-checked in Google Analytics : Real-Time section : Content section --

<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-475021xx-x', 'auto');
  ga('send', 'pageview');
</script>

where xx-x masks the real account code.

The script is placed just before </head>

We have upgraded our account to Universal Analytics. Google tells us that this is the script to use; directly copied and pasted here (with the masked account code).

On the Google Analytics page, the test page is loaded as an ACTIVE PAGE. I click links on the test page to trigger ga.

Is there an error in this script? For example, I see on other Stackoverflow posts that 'auto' is replaced with the real domain. But I don't see Google instructions to make that substitution.

Am I doing something else wrong?

like image 302
Jay Gray Avatar asked Sep 05 '14 01:09

Jay Gray


2 Answers

You can check the health of your tag using Google tag assistant, and also check with developer tools whether you can see data being sent to your GA account. Also look in your account under Property > Tracking Info > Tracking Code for the status of your tracking code. But if you are not seeing Real Time data then something could be wrong.

The third parameter in the 'create' method sets the cookie domain. It is optional and with 'auto', it sets the cookie domain to the highest domain level possible. Without it, the cookie domain will be set to the website domain without the www. prefix.

like image 91
nyuen Avatar answered Sep 22 '22 12:09

nyuen


I did the same thing as you back then.

Mine started showing data in about 12-24 hours after I put the Google Analytics code.

I suggest waiting for another day then checking if data comes up.


Given that this answer can only be verified until we wait for a certain amount of time, please hold off setting this as the correct answer until then.

like image 24
Zaenille Avatar answered Sep 22 '22 12:09

Zaenille