jquery - Google Analytics Tracking Event Not Working -


i've added tracking event using jquery onclick using google analytics.js doesn't work @ all.. fire event undefined in response.

<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-36828246-2', 'curiousworkout.com');   ga('send', 'pageview'); </script>  <script type="text/javascript"> jquery(document).ready(function(){  $('#generate_header').click(function(event){     event.preventdefault();     ga('generate_workout', 'header_click');     window.location = $(this).attr("href"); });  $('#generate_top_list').click(function(){     ga('generate_workout', 'top_list_click');     window.location = $(this).attr("href"); });  $('#generate_top_main').click(function(){     ga('generate_workout', 'top_main_click');     window.location = $(this).attr("href"); });  }); </script> 

it looks me event submission lines missing lot of data, notably command send event.

from the universal analytics event tracking guide:

to send event, pass ga function send command event hit type

ga('send', 'event', 'button', 'click', 'nav buttons', 4); 

where:

  • button category
  • click action
  • nav buttons label
  • 4 value

from code, assume "generate_workout" category of event action trying track , "top_main_click" action, , don't need value prescribed event.

this gives this:

ga('send', 'event', 'generate_workout', 'top_main_click'); 

if relevant, consider adding label attribute url of page action generated can track events come from.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -