title: Varnish keeps caching my tracking software
body: <p>I have a Varnish setup for one of my sites. I'm using the open source software Piwik for my stats tracking.</p>
  
  <p>Piwik have an option of having a Proxy for tracking, which means that the URL of Piwik won't be revealed in my source code. Basically it's a PHP file that sits on my wordpress install and it sends CURL posts to my Piwik install...</p>
  
  <p>Now, I set up my Varnish using:
  <a href="https://github.com/mattiasgeniar/varnish-3.0-configuration-templates" rel="nofollow">https://github.com/mattiasgeniar/varnish-3.0-configuration-templates</a></p>
  
  <p>In vcl_fetch I added:</p>
  
  <pre><code>if (req.url ~ "piwik") {
      set beresp.ttl = 120s;
      return (hit_for_pass);
  }
  </code></pre>
  
  <p>In vcl_recv I added:</p>
  
  <pre><code>if (req.url ~ "piwik") {
      return (pass);
  }
  </code></pre>
  
  <p>What happens is, I see only 50% of the traffic I actually have on the website...</p>
  
  <p>I'm afraid it's because of my vcl_fetch settings...</p>
  
  <p>I read the differences between pass and hit_for_pass and from what I understand beresp.ttl is a config that I guides varnish to keep doing pass for 120s</p>
  
  <p>One more thing, W3TotalCache on WP adds some caching headers like Max-Age &amp; expires to my piwik.php file. Without Varnish it's still working well and tracking correctly. Is it possible that there is some sort of collision between Varnish and those headers?</p>
  
  <p>Do I get it right?
  Why do you think 50% of my tracking is missed?</p>
  
  <p>Thanks.</p>