Boost site performance with Server-Side Tagging: Cloudflare Zaraz vs traditional Google Analytics
Learn how server-side tagging with Cloudflare Zaraz can maintain 100% PageSpeed performance while still tracking your analytics data.
If you've ever run PageSpeed Insights on your website, you've likely noticed how third-party tracking scripts can significantly impact your performance score. Google Analytics, while essential for understanding your audience, often comes at the cost of site speed. But what if I told you there's a way to have your cake and eat it too?
The Performance Impact of Traditional Analytics
Let's start with a baseline. Here's a PageSpeed Insights score for a page without any tracking scripts:

Perfect 100 score! But we need analytics to understand our users. So what happens when we add Google Analytics using the traditional gtag.js approach?

Our performance score drops to 94. While this might not seem dramatic, it does indicate a significant impact.
- Additional JavaScript to download and parse
- Main thread blocking during initialization
- Network requests that can delay page interactivity
- Potential impact on Core Web Vitals metrics
Hello Server-Side Tagging with Cloudflare Zaraz
Cloudflare Zaraz is a server-side tag manager that moves third-party tools and services from the browser to Cloudflare's edge network. Instead of loading analytics scripts directly in the user's browser, Zaraz handles everything server-side.
How Zaraz Works
When a user visits your site:
- Zaraz injects a lightweight script (under 10KB) into your pages
- This script collects necessary data and sends it to Cloudflare's edge
- Cloudflare's servers then forward this data to your analytics providers
- All heavy processing happens on Cloudflare's infrastructure, not in the user's browser
The Results Speak for Themselves
Here's the same page with Google Analytics implemented through Cloudflare Zaraz:

We're back to a perfect 100 score! This isn't just about vanity metrics – it translates to real benefits:
- Faster page loads: Less JavaScript means quicker initial renders
- Better Core Web Vitals: Improved LCP, FID, and CLS scores
- Enhanced privacy: User data is proxied through Cloudflare, reducing direct third-party exposure
- Simplified management: Configure all your tools in one place
Setting Up Zaraz for Your Site
If you're using Cloudflare, setting up Zaraz is straightforward:
- Log into your Cloudflare dashboard
- Navigate to your site's Zaraz section
- Add Google Analytics as a tool
- Configure your measurement ID and tracking preferences
- Remove any existing gtag.js implementations from your site
- Deploy and watch your PageSpeed scores improve!
Beyond Google Analytics
Zaraz supports many popular tools beyond Google Analytics:
- Facebook Pixel
- LinkedIn Insights
- Twitter Pixel
- Microsoft Clarity
- Hotjar
- And dozens more...
Each tool you move to server-side execution is one less script slowing down your users' experience.
Considerations and Trade-offs
While server-side tagging offers significant benefits, there are some considerations:
- Cloudflare Zaraz is much more technical than Google Tag Manager.
- Cloudflare dependency: You need to be using Cloudflare as your CDN/proxy
- Debugging: Server-side events can be harder to debug than client-side
- Custom implementations: Some advanced tracking scenarios might require workarounds
- Real-time data: There might be slight delays compared to direct client-side tracking
Have you tried server-side tagging? What's been your experience with balancing analytics needs and performance? Let me know in the comments or reach out on social media!