9

New to google analytics so bear with me. I added the event tracking to my code, but when i check in the reporting behavior event tab it's blank. Here is my code.

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

here is an example of my a tag

<a href="http://example.com/" target="_blank" class="app-logo" ga('send', 'event', 'Link', 'Click', 'example.com');>
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Zachary Almero
  • 127
  • 1
  • 2
  • 7

2 Answers2

56

In google-analytics, for the correct website, look on the "realtime/events" page and see if events are appearing there (they should appear here within a few seconds, after being triggered on your website).

If not, you might have added a filter, to filter out events generated by traffic from your own IP. You can find this filter under "admin" and then "all filters". If so, remove it (or temporarily change the IP-address, so it doesn't match). After that, generate a few events on your website and look again on the google-analytics page, under realtime traffic / events page.

If they work under realtime, it should also work in non-realtime (but it might take 24-48 hours to appear there!)

kalmiya
  • 2,988
  • 30
  • 38
5

Not sure if this just a typo in your example, but you are missing the event handler in your link:

<a href="http://example.com/" target="_blank" class="app-logo" onclick="ga('send', 'event', 'Link', 'Click', 'example.com');"></a>

The event handler ("onclick") is the bit that specifies which action shall trigger the javascript code. If you just dump the event call in the HTML it will not even be recognized as JS.

Eike Pierstorff
  • 31,996
  • 4
  • 43
  • 62
  • that's what i was missing. Thank you very much, nothing is showing up now but im sure there is a 24hr turn around, right? – Zachary Almero Jul 11 '16 at 21:06
  • You should be seeing events in the realtime tab, plus you could use a tool like Google Tag Assistant (https://chrome.google.com/webstore/detail/tag-assistant-by-google/kejbdjndbnbjgmefkgdddjlbokphdefk?hl=en) to confirm if everything is working. But yes, there is some delay due to processing time. – Eike Pierstorff Jul 12 '16 at 05:26