Search code examples
google-analyticsgoogle-analytics-api

Why is Google Analytics Reporting Real Time Events?


I'm not seeing any events in GA Realtime reporting after implementing below code for GA Event tracking... Standard Pageviews reporting has been working fine for since I implemented last month, the issue is just with "Events".

I tried to follow the instructions per https://developers.google.com/analytics/devguides/collection/analyticsjs/events#overview.

This is a screenshot of my Chrome Dev Tools Console https://www.dropbox.com/s/euamp6bz87qh6g9/Screenshot%202016-06-04%2018.33.19.png?dl=0

This is a screenshot of my Chrome Dev Tools Network: https://www.dropbox.com/s/71lqmv492pquk1x/Screenshot%202016-06-04%2018.31.56.png?dl=0

Script in HTML before end tag with my UA number here noted as Xs/Y - i am using a server side with this code for each page:

<!-- Google Analytics -->

<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-xxxxxxxx-y', 'auto');
ga('send', 'pageview', 'event');
</script>

<script async src='https://www.google-analytics.com/analytics.js'>
</script>
<!-- End Google Analytics -->

<!-- HTML Code -->
<ul>
<li><a href="http://iprobesolutions.com/downloads/ae-specs-en-us-bosch-dicentis-wireless.docx" onClick="ga('send', 'event', 'download', 'click', ‘Download DICENTIS Wireless A &amp; E');">Download DICENTIS Wireless A &amp; E Specifications</a></li>
</ul>

Any feedback on what I could be doing wrong would be much appreciated!

This is my edited and now working code based on feedback received:

 <!-- HTML Code -->
<ul>
<li><a href="http://iprobesolutions.com/downloads/ae-specs-en-us-bosch-dicentis-wireless.docx" onClick="ga('send', 'event', 'download', 'click', 'Download DICENTIS Wireless A &amp; E');">Download DICENTIS Wireless A &amp; E Specifications</a></li>
</ul>

Solution

  • If you are seeing pageviews and not events, then it's not really a matter time and waiting for the events to be processed, but probably something to do with your code or implementation. I am seeing a potential issue with the onclick code, however:

    ga('send', 'event', 'download', 'click', ‘Download DICENTIS Wireless A &amp; E');
    

    Your event label is using a smart quote rather than a straight quote. When I paste the event code into the console, I get an error message, so you should change the to a ' and make sure they are all straight quotes.

    Also, when you are sending your pageview with ga('send', 'pageview', 'event'), I'm not sure if you are aware, but you are changing the page path from the default of whatever is normally sent with the pageview, to event. So in your reports, you would see a page path for your pageviews of event.