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.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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

<!--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!}}
share|improve this question

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 }

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

Your Answer


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.