Zaraz
By the end of this lesson you will understand how Zaraz replaces traditional tag managers, why it's faster and more private, and how to set it up.
What Is Zaraz?
Zaraz is Cloudflare's server-side tag manager. Instead of loading third-party scripts (Google Analytics, Facebook Pixel, etc.) directly in the browser, Zaraz loads them at the edge — keeping your pages fast and your users' data private.
flowchart LR
subgraph Traditional["Traditional Tag Manager"]
T_PAGE["Your Page"] --> T_GTM["GTM Script\n(Browser)"]
T_GTM --> T_GA["Google Analytics\n(Browser)"]
T_GTM --> T_FB["Facebook Pixel\n(Browser)"]
T_GTM --> T_OTHER["Other Scripts\n(Browser)"]
end
subgraph Zaraz["Cloudflare Zaraz"]
Z_PAGE["Your Page"] --> Z_EDGE["Zaraz\n(Cloudflare Edge)"]
Z_EDGE --> Z_GA["Google Analytics\n(Server-side)"]
Z_EDGE --> Z_FB["Facebook Pixel\n(Server-side)"]
Z_EDGE --> Z_OTHER["Other Services\n(Server-side)"]
end
style T_GTM fill:#dc2626,color:#fff,stroke:#b91c1c
style Z_EDGE fill:#16a34a,color:#fff,stroke:#15803d
Why Zaraz?
| Feature | Traditional Tag Manager | Zaraz |
|---|---|---|
| Page speed | Slows page (many JS scripts in browser) | Fast (single lightweight script) |
| Privacy | Scripts see full user data | Data filtered at edge before sending |
| Third-party code in browser | ✅ Full access to DOM, cookies | ❌ Scripts run server-side |
| Cookie consent | Complex consent management | Built-in consent management |
| Cost | Free (GTM) to expensive | Free (with limits) |
Free Tier
| Resource | Free Plan |
|---|---|
| Events | 1 million per month |
| Tools | Unlimited |
| Consent management | ✅ |
| Custom actions | 20 per tool |
Setting Up Zaraz
- Go to Cloudflare Dashboard → Zaraz
- Zaraz is automatically active on proxied domains — no script tag needed
- Click "Add new tool"
- Select from supported integrations:
Supported Tools
| Category | Examples |
|---|---|
| Analytics | Google Analytics 4, Bing UET, Plausible, Fathom |
| Marketing | Facebook Pixel, Google Ads, LinkedIn Insight |
| Customer support | Intercom, Zendesk, Crisp |
| A/B Testing | Google Optimize, Optimizely |
| Custom | Custom events, HTTP endpoints |
Example: Adding Google Analytics 4
- Click "Add new tool" → Select Google Analytics 4
- Enter your Measurement ID (G-XXXXXXXXXX)
- Configure triggers:
- Page View: Fires on every page load
- Custom Events: Configure specific event triggers
- Save — Google Analytics is now running server-side via Zaraz
Privacy and Consent
Zaraz includes a built-in consent management tool:
- Go to Zaraz → Consent
- Define consent purposes (Analytics, Marketing, Functionality)
- Assign tools to purposes
- Zaraz automatically shows a consent banner and only fires tools that the user has consented to
This helps with GDPR, CCPA, and other privacy regulations without additional consent management solutions.
Common Misconceptions
"Zaraz is just another tag manager like GTM"
Reality: Zaraz fundamentally differs from GTM by running third-party code server-side (at Cloudflare's edge), not in the user's browser. This eliminates third-party JavaScript from your pages, improving speed, security, and privacy.
"Zaraz requires removing existing analytics"
Reality: You can migrate gradually. Run Zaraz alongside existing scripts, verify data parity, then remove the client-side scripts.
Key Takeaways
- Zaraz is a server-side tag manager that runs third-party scripts at the edge — not in the browser.
- Faster pages — one lightweight script replaces many heavy third-party scripts.
- Better privacy — data is filtered at the edge before being sent to third parties.
- Built-in consent management for GDPR/CCPA compliance.
- Free tier: 1M events/month, unlimited tools.
What's Next
- Continue to Time Services and Randomness Beacon to learn about Cloudflare's time and cryptographic services.