Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Related subject: Privoxy: blocking twitter, facebook and google outside of their domains + HTTPS

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./*
share|improve this question
add comment

1 Answer

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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