Stats go missing after upgrading to cloudflare with mod_cloudflare


I’ve noticed that our referral search traffic after moving to cloudflare is not being reported. We do have mod_cloudflare installed as per cloudflare supports site and they have sent me here to see if I can get assistance.

I’ve attached 2 photos - one shows google analytics traffic for organic google searches. The other shows piwik. Piwik has no visitors with a google referrer and google analytics is showing traffic.

I’m not sure if the problem is with piwik or a configuration, but I do hope the community will be able to help me so thank you in advance for anyone that can provide support.

Thank you.

I should probably add the obvious - that other stats are being displayed for those days so I know the tracking code is working. It’s just all Referrers and Goals.


Nothing has changed on our end regarding this, maybe you can try upgrade to the latest beta: I would like to test early beta and RC releases, how do I enable automatic updates to use these development versions? - Analytics Platform - Matomo

are you seeing all referrers going to zero, or only a few like google?

Hello Matt,

I’m on the latest version of piwik (released - not beta but will upgrade) and had been when we introduced cloudflare which brought on all referrers dropping to zero.

search engines & keyworsd , campaigns, website & social all do not get reported.
Example 1:
[attachment 1713 2014-05-04_1544.png]
Example 2:
[attachment 1714 2014-05-04_1543.png]

Visitors do…
Example 1:
[attachment 1715 visitors.png]

Are you using a redirect on your website landing page?
If you are using a redirect, the visitor browser may lose the referer information. If you are tracking campaigns, and the landing page has a redirect, the URL loaded after the redirection will have lost the URL parameters. Make sure that your visitors arrive directly on the page with the Piwik tracking code installed.

Ref: FAQ: Visits from search engines or campaigns are not recorded, Piwik shows "There is no data for this report" for all Referrers reports. - Analytics Platform - Matomo

Rainsnow: Did you find a solution to your problem?
Since I started using CloudFlare, virtually all my visitors are shown as being located in San Francisco.
I rely on Piwik to identify my visitors, so I need a fix OR must discontinue CloudFlare.

@Thomas to configure PIwik with CloudFlare see: How do I configure Piwik when the server is installed behind a proxy? - Analytics Platform - Matomo


  1. Whenever people ask about Cloudflare they get referred to this FAQ page:

  1. It says to manually modify config.ini.php with this:

; CloudFlare proxy
; proxy_client_headers[] = HTTP_CF_CONNECTING_IP
; ISP proxy (Client-IP)
;proxy_client_headers[] = HTTP_CLIENT_IP
; standard proxy
;proxy_client_headers[] = HTTP_X_FORWARDED_FOR
;proxy_host_headers[] = HTTP_X_FORWARDED_HOST

  1. It does NOT tell you WHICH lines to uncomment:

3.a. Is this correct?

proxy_client_headers[] = "HTTP_CF_CONNECTING_IP"
proxy_client_headers[] = “HTTP_X_FORWARDED_FOR”

3.b. What about this?

proxy_client_headers[] = "HTTP_X_FORWARDED_FOR"
proxy_client_headers[] = “HTTP_CF_CONNECTING_IP”

3.c. What about this?

proxy_client_headers[] = “HTTP_CF_CONNECTING_IP”

  1. Of the 3 options a-b-c in 3 above that are correct, what would the resulting difference be?