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']);

(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);

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.

1 Answer 1


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']);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.