Sunday 15 June 2014

Adding Anchor Tag Tracking to Google Universal Analytics -



Adding Anchor Tag Tracking to Google Universal Analytics -

i've read 9 of articles on so, none of them working. hope has simple reply this.

we have site, www.fishales.com. paralax, single page site 6 different sections. default, ga doesn't register of clicks anchor tags. when @ ga dashboard, shows super high bounce rate, exit rate because people info 1 page.

here have added straight before end body tag:

<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-53549640-1', {'allowanchor': true}); ga('send', 'pageview', { 'page': location.pathname + location.search + location.hash}); jquery(document).ready(function () { var hashtag = /#\s+/ jquery('.gatmenu a').click(function(){ var match = jquery(this).attr('href').match(hashtag); ga('send', 'pageview', '/' + match[0]); }) }); </script>

as menu links, code:

<ul class="gatmenu"> <li><a href="#beer">beers</a></li> <li><a href="#food">menu</a></li> <li><a href="#events">events</a></li> <li><a href="http://fishales.com/images/gallery/1.jpg" class="fresco" data-fresco-group="gallery" data-fresco-caption="fish ale">gallery</a></li> <li><a href="#about">our story</a></li> <li><a href="#contact">contact</a></li> </ul>

however, ga has stopped working since implemented this. ideas oh wise ones?

google-analytics anchor universal universal-analytics

No comments:

Post a Comment