HomePostscloudflare traffic drop

What to Do If Your Traffic Drops after Migrating to Cloudflare

Date
Last Updated
Contents

If you've moved to Cloudflare and noticed a sudden drop in daily active visitors this is how to solve the problem.

Check for common Cloudflare issues

Before we jump into a technical fix, let's eliminate the most common Cloudflare issues first. Check that your DNS records, page rules and SSL configurations are correct. Pay attention to:

  1. Non-WWW to WWW redirections
  2. Page rules which cause infinite loops
  3. DNS rules are incorrect, or Cloudflare is not enabled
  4. Selecting the wrong flexible, strict or full SSL setting
  5. You may have been counting bot traffic in your previous analytics, making an artifically high visitor count. Cloudflare blocks malicious traffic, leading to lower visitor counts.

Why have my daily unique visitors dropped after switching to Cloudflare?

Before you switched to Cloudflare, visitors connected directly to your server.

After switching to Cloudflare, visitors connect to Cloudflare, which then retrieves information from your server as required. This allows Cloudflare to act as a reverse proxy, caching frequently requested files and protecting your server.

As visitors don't connect to your server directly anymore, you no longer have access to the visitors IP address.

This causes issues for some analytics tools, which track daily active visitors by their IP address.

Helpfully Cloudflare does provide the original visitors IP address in an HTTP header called CF-Connecting-IP

Get the original IP addresses for your visitors into your analytics tool by choosing one of the options below.

  • Cloudflare Enterprise: Upgrade to Cloudflare Enterprise and enable the True-Client-Ip setting, following the instructions here
  • Apache or Nginx: Install mod_cloudflare or mod_remoteip following the instructions provided by CloudFlare
  • Node: Install request-ip, then pass the user IP to your analytics platform. On Google Analytics, you can send this as an IP override using the uip parameter
  • Other: Get the CF-Connecting-IP and pass this to your analytics tools and/or logs directly

Thanks for Reading!

I always appreciate feedback or suggestions for future blog posts. You can find me on LinkedIn or if you want to improve the article to help future readers, please feel free to submit a PR.

🦉 2969 days

Duolingo Streak

Proudly created in beautiful Norway 🇳🇴