Mobile app version of vmapp.org
Login or Join
Yeniel560

: SetLocalServerMode in Google Analytics still tracks visits I run a website where I am including an older script version of Google Analytics. I really only need it to create the necessary cookies,

@Yeniel560

Posted in: #GoogleAnalytics

I run a website where I am including an older script version of Google Analytics. I really only need it to create the necessary cookies, not for tracking, so I set it to Local Server Mode. Link here.

This here is the script:

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push('_setLocalGifPath','http://www.site.tld/sites/all/themes/site/images/1px.gif');
_gaq.push('_setLocalServerMode');
_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);
})();
</script>


LocalServerMode should prevent Google Analytics from tracking visits to my website. It's not working though; visits are still being registered. Fiddler also shows that the local 1px.gif is never requested. Mostly setLocalServerMode does not appear to do anything.

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Yeniel560

1 Comments

Sorted by latest first Latest Oldest Best

 

@Rambettina238

The lines you've added to the javascript are missing square brackets (compare your code to the documentation you linked to). It should be:

_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_setLocalGifPath','http://www.site.tld/sites/all/themes/site/images/1px.gif']);
_gaq.push(['_setLocalServerMode']);
_gaq.push(['_trackPageview']);

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme