Cloudflare UTM Tracking: Complete Guide for Marketers
You’ve spent hours crafting the perfect UTM-tagged campaign links, only to find your analytics tools aren’t picking up the data. If you use Cloudflare to speed up your site, this frustrating issue is more common than you think. Cloudflare UTM tracking requires a few extra setup steps to ensure your campaign parameters survive caching, redirects, and security rules. In this guide, you’ll learn exactly how to configure Cloudflare to preserve UTM data, fix common tracking gaps, and get accurate insights into which campaigns are driving your traffic.
What Is Cloudflare UTM Tracking?
UTM (Urchin Tracking Module) parameters are text tags added to the end of URLs to track the source, medium, campaign, and content of incoming traffic. Marketers use them to measure the performance of social media posts, email newsletters, paid ads, and other campaigns in tools like Google Analytics or Adobe Analytics.
Cloudflare UTM tracking refers to the process of configuring your Cloudflare account to pass these query parameters through to your analytics tools, instead of stripping them via caching, redirects, or security settings. Without proper setup, Cloudflare may treat UTM-tagged URLs as unique pages, or worse, drop the parameters entirely before they reach your tracking tools.
Why Do UTMs Break With Cloudflare?
Cloudflare’s default settings prioritize performance and security, which can accidentally interfere with UTM tracking. Common culprits include:
- Caching rules that ignore query strings: Cloudflare’s default "Standard" cache level includes query strings, but if you’ve manually set caching to "Ignore Query String", UTMs will be stripped from cached pages.
- Redirect rules without query preservation: If you use Cloudflare page rules to redirect HTTP to HTTPS, or old URLs to new ones, failing to check the "Preserve query string" box will drop UTMs during the redirect.
- Security filters: Overly strict bot management or firewall rules may flag UTM-tagged requests as suspicious and block or alter them.
Step-by-Step: Set Up Cloudflare UTM Tracking
Follow these steps to ensure your UTM parameters are preserved across all Cloudflare configurations:
-
Check Your Cloudflare Caching Settings
Log in to your Cloudflare dashboard, select your site, and navigate to Caching > Configuration. Verify that your Cache Level is set to Standard or Cache Everything (not Ignore Query String). If you use the Query String Sort setting, select Preserve to keep UTM parameters in the cache key.
-
Configure Page Rules to Preserve UTMs
Go to Rules > Page Rules and create a new rule matching *yourdomain.com/* (replace with your actual domain). Add the setting Cache Level > Standard to ensure query strings are included in cached content. For any redirect rules (e.g., HTTP to HTTPS), enable the Preserve query string toggle when setting up the forwarding URL.
For more advanced page rule setups, refer to our internal guide Cloudflare Page Rules: Complete Setup Guide.
-
Bypass Caching for Analytics Endpoints
If your analytics tool loads from your own domain (e.g., self-hosted Matomo or a custom Google Analytics proxy), create a page rule to bypass cache for that path (e.g., /analytics/*). This ensures UTM data is not stripped before it reaches your tracking tool.
-
Test Your UTM Tracking Setup
Use a free UTM builder to create a test link with unique parameters (e.g., ?utm_source=test&utm_medium=blog&utm_campaign=cloudflare_guide). Click the link, then check your real-time analytics dashboard to confirm the parameters are recorded. You can also view incoming requests in Cloudflare’s Traffic > Requests log to verify UTMs are present.
Common Cloudflare UTM Tracking Issues (and Fixes)
- UTMs missing in analytics: Check if Ignore Query String is enabled in your caching settings. Switch to Standard cache level to fix.
- UTMs work for some pages but not others: Review page rules for the affected pages. Ensure no rules are set to strip query strings for those specific URLs.
- UTMs stripped after HTTPS redirect: If you use Cloudflare’s Always Use HTTPS setting, verify that any associated forwarding rules have Preserve query string enabled.
Advanced Tips for Better Cloudflare UTM Tracking
- Use Cloudflare Workers to create a custom logging endpoint that captures UTM parameters even if your main analytics tool fails.
- Set up custom dimensions in Cloudflare Analytics to track UTMs directly in your Cloudflare dashboard, no third-party tools required.
- Combine UTM tracking with Cloudflare’s Bot Management to filter out fake campaign traffic from bots scraping your UTM-tagged links.
- For more on UTM best practices, check out our internal guide to building high-converting UTM parameters.
As per Google’s official campaign tracking documentation, UTM parameters must be preserved end-to-end to deliver accurate performance data.
Conclusion
Cloudflare UTM tracking doesn’t have to be a headache. By adjusting a few caching and page rule settings, you can ensure your campaign parameters are preserved end-to-end, giving you accurate data to optimize your marketing spend. Remember to test your setup regularly, especially after making changes to your Cloudflare configuration, to catch tracking gaps early.
FAQs About Cloudflare UTM Tracking
- Does Cloudflare block UTM parameters by default?
- No, Cloudflare does not block UTMs by default, but default caching settings may ignore query strings, which strips UTMs before they reach your analytics tools.
- Can I track UTMs without changing Cloudflare settings?
- Only if your caching is set to preserve query strings already. Most users need to adjust caching or page rules to ensure consistent UTM tracking.
- Will preserving UTMs increase my Cloudflare cache miss rate?
- Slightly, because pages with different UTM parameters will be cached as separate entries. For high-traffic sites, consider using Query String Sort to normalize UTMs before caching, so UTM-tagged URLs for the same page share a cache entry.
- How do I check if Cloudflare is stripping my UTMs?
- Use Cloudflare’s Traffic > Requests log to view incoming requests. Filter for a test UTM parameter: if the request shows the UTM in the log but your analytics doesn’t, the issue is with your analytics setup, not Cloudflare. If the request doesn’t show the UTM, Cloudflare is stripping it.
Ready to fix your broken UTM tracking? Start by checking your Cloudflare caching settings today. Need help with a custom setup? Contact our team of Cloudflare experts for a free 15-minute audit.
Comments are closed, but trackbacks and pingbacks are open.