Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Event Tracking Using Google Universal Analytics

I have seen other topics on this issue. I have tried to search and cant figure it out so i need help.

My tracking code is...

<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-41800392-1', 'monsourlawfirm.org');
  ga('send', 'pageview');

</script>

and the event is a click to call on the site. the code for that is...

<a href="tel:8882594979" onClick="ga('send', 'mobile', 'click to call', '888-259-4979');">1 (888) 259-4979</a>

I have waited 24hrs and do not see anything recording.

like image 416
wfoody Avatar asked Nov 13 '13 16:11

wfoody


People also ask

How does Google Analytics event tracking work?

Event tracking leverages a custom code snippet that you add to the elements that you want to track on your website. Whenever users interact with that element, the code tells Google Analytics to record the event.


1 Answers

You're missing the hit type parameter. Check out Universal Analytics documentation. Your event should be:

<a href="tel:8882594979" onClick="ga('send', 'event', 'mobile', 'click to call', '888-259-4979');">1 (888) 259-4979</a>

You can verify that the event is firing using a tool to monitor http requests or by logging into your GA account and looking at real-time reports.

like image 70
Blexy Avatar answered Sep 21 '22 06:09

Blexy