javascript - Google Event Tracker not firing -
i've got event tracker (located in main.js rather inline click handler) supposed fire when user clicks on item specific class. however, client reporting these event tracker never fire, or atleast never sees response them. however, other ga event trackers throughout site working. can see issues code below causing this?
the js function in main.js handles looks so:
$('.vote.complete').click(function() { whence = "tocompleted"; vote_id = $(this).data('vote_id'); cid = $(this).data('campaign_id'); c_title = $('#outfitpair'+cid).data('campaign_title'); u_id = $('#outfitpair'+cid).data('other_id'); _gaq = window._gaq; if(_gaq != undefined){ _gaq.push(['_trackevent', 'viewpreviousvote', c_title, u_id]); } $('#outfitpair'+cid).find('.button.vote').removeclass('to-vote'); $(this).addclass('to-vote'); $.get('/campaigns/new_pair?whence='+whence+'&vote_id='+vote_id) return false; });
the html being clicked looks like:
<a href="#" class="button vote complete" data-vote_id="9490" data-campaign_id="5"> <span>01</span> </a>
and script in layout header:
<script> var _gaq = _gaq || []; _gaq.push(['_setaccount', 'ua-xxxxxxxx-x']); _gaq.push(['_setdomainname', 'mywebsite.com']); _gaq.push(['_trackpageview']); (function() { var ga = document.createelement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getelementsbytagname('script')[0]; s.parentnode.insertbefore(ga, s); })(); window._gaq = _gaq; </script>
the ga debugger returns in js console upon loading web page, although nothing new shows when try trigger event tracker:
registered new plugin: "linker" analytics_debug.js:5 creating new tracker: t0 analytics_debug.js:5 sent beacon: v=1&_v=j11d&a=xxxxxxxxx&t=pageview&_s=1&dl=http%3a%2f%2fapp.website.com%2fcampaigns%2fvote&dr=&ul=en-us&de=utf-8&dt=website&sd=32-bit&sr=1366x768&vp=1349x667&je=1&fl=11.8%20r800&_u=mac~&cid=xx.xx&tid=ua-xxxxxxx-x&z=812880404 analytics_debug.js:5 adsenseid (&a): xxxxxxxxxx analytics_debug.js:5 apiversion (&v): 1 analytics_debug.js:5 clientid (&cid): xxx.xxx analytics_debug.js:5 encoding (&de): utf-8 analytics_debug.js:5 flashversion (&fl): 11.8 r800 analytics_debug.js:5 hittype (&t): pageview analytics_debug.js:5 javaenabled (&je): 1 analytics_debug.js:5 language (&ul): en-us analytics_debug.js:5 location (&dl): http://app.website.com analytics_debug.js:5 referrer (&dr): analytics_debug.js:5 screencolors (&sd): 32-bit analytics_debug.js:5 screenresolution (&sr): 1366x768 analytics_debug.js:5 title (&dt): website analytics_debug.js:5 trackingid (&tid): ua-xxxxxxxx-x analytics_debug.js:5 viewportsize (&vp): 1349x667 analytics_debug.js:5
is other_id
value assigned u_id
number? jquery .data()
try covert javascript value, , _trackevent
can fail silently if opt_label
parameter integer.
you can use .attr()
fetch attribute value without conversion. try:
u_id = $('#outfitpair'+cid).attr('data-other_id');
Comments
Post a Comment