4

Related subject: Privoxy: blocking twitter, facebook and google outside of their domainslr

Never mind what rule I am adding to the default.filter file, I don't make it to block these scripts.

<!--Google Analytics Script Start -->
<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-649033-1']);
  _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';
    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
  })();

</script>
<!--Google Analytics Script End -->

So far I have tried these rules:

s|<script [^>]*(google-analytics.com/ga.js).*>(.*</script>)|<!-- utma Cookies-->|gis
s|<script [^>]*(google-analytics).*>(.*</script>)|<!-- utma Cookies-->|gis
s|<script [^>]*(google-analytics*).*>(.*</script>)|<!-- utma Cookies-->|gis
s|<script [^>]*(google-analytics*).*</script>)|<!-- utma Cookies-->|gis
s|<script [^>]*(analytics*).*</script>)|<!-- utma Cookies-->|gis

What is needed to be done to erase the code?

P.S I am also using this in my user.action file

{+block{No Bull!}}
.google-analytics./*
jojo
  • 119
  • 2
  • 6

1 Answers1

3

Assuming you want to block loading of only http://www.google-analytics.com/ga.js, open your user.action file, locate the section that has { +block-as-image } at the start and put .google-analytics.com/ga.js on a line of its own after { +block-as-image }. Since many sites just use ga.js, you may prefer just /.*ga.js.

In other words,

{ +block-as-image }
#.google-analytics.com/ga.js
#/.*ga.js

Uncomment the one you want to use. Delete the other. The problem with a short pattern is the chance of unintended blocking. The other point is that Privoxy won't block content on https sites.