Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

can I prevent google analytics from placing its script on pages I open?

  • 3 replies
  • 16 have this problem
  • 2 views
  • Last reply by mykstor

more options

I resent google analytics for placing its script on every page that website builders ask it to. Users place a script like this on their page, which then google does when this request script is present. It always looks similar to this:

<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.[my spoiler]com/' ga.js' type='text/javascript'%3E%3C/script%3E")); </script>

When you open any page containing this script, it will write google's analytic script at the top of that page, this in turn, collects data about you and your browsing. At the bottom of the page is the second half of this b.s. script. How can I program Firefox to recognize this particular string at onload and jimmy this script so it can't write the script it's meant to?

Microsoft and others also have such gimmicks I'd like to jam. MS puts a 1x1 pixel "img" tag, which isn't meant to be noticed, but Firefox automatically performs a 'get' for it. This phony image is really a reference number that ends up cached.

Even this FireFof Help Page puts a similar script on this page:

<script src="/media/js/webtrends.[my spoiler]js" defer="">

Is anyone else ticked off by this? If so, can you offer help?

Many thanks in advance!

<p style="color:red;">I resent google analytics for placing its script on every page that website builders ask it to. Users place a script like this on their page, which then google does when this request script is present. It always looks similar to this:<br><br> <code> <script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.[my spoiler]com/' ga.js' type='text/javascript'%3E%3C/script%3E")); </script> </code> <br><br> When you open any page containing this script, it will write google's analytic script at the top of that page, this in turn, collects data about you and your browsing. At the bottom of the page is the second half of this b.s. script. How can I program Firefox to recognize this particular string at onload and jimmy this script so it can't write the script it's meant to?<br><br> Microsoft and others also have such gimmicks I'd like to jam. MS puts a 1x1 pixel "img" tag, which isn't meant to be noticed, but Firefox automatically performs a 'get' for it. This phony image is really a reference number that ends up cached.<br><br>Even this FireFof Help Page puts a similar script on this page:<br><br><code> <script src="/media/js/webtrends.[my spoiler]js" defer=""></code><br><br> Is anyone else ticked off by this? If so, can you offer help?<br><br> Many thanks in advance!

Modified by mykstor

Chosen solution

Can I prevent Google Analytics from placing its script on pages I open? :

Both a hosts file and the Adblock Plus extension will remove, you may have to add your own more aggressive filters based on your own usage and what you find. Some sites may not work if they find content is blocked that's what makes filters more personal (see link below for more information)

I have three subscription filters in "Adblock Plus" and my own as well

  • EasyList US is the main comprehensive filter used by Adblock Plus users
  • Fanboy's List many additional filters not included above
  • Peter Lowe's List -- seems oriented to blocking trackers

Also see How do I block advertising for more information

Read this answer in context 👍 2

All Replies (3)

more options

Chosen Solution

Can I prevent Google Analytics from placing its script on pages I open? :

Both a hosts file and the Adblock Plus extension will remove, you may have to add your own more aggressive filters based on your own usage and what you find. Some sites may not work if they find content is blocked that's what makes filters more personal (see link below for more information)

I have three subscription filters in "Adblock Plus" and my own as well

  • EasyList US is the main comprehensive filter used by Adblock Plus users
  • Fanboy's List many additional filters not included above
  • Peter Lowe's List -- seems oriented to blocking trackers

Also see How do I block advertising for more information

Modified by David McRitchie

more options

Try the NoScript extension, works for issues just like the one you posted.

https://addons.mozilla.org/en-US/firefox/addon/noscript/

more options

Thanks to all of you. Hard to choose a 'best' answer. What's cool is that people care enough to take the time to help. I'll have to experiment with a bit and a bit of that, I guess. I wish I just knew how to pre-load a single script that would recognize the starting part of the string that comprises google analytics script that causes it to write another one, and a couple more, perhaps. The google script tells your browser to write a more specific one for you.