Cloudflare Zaraz: Third-Party Tool Management -- Complete Guide
In this tutorial, you will learn how Cloudflare Zaraz enables you to load third-party tools such as Google Analytics, Facebook Pixel, and marketing scripts from Cloudflare's edge network, improving page performance, visitor privacy, and security Compliance.
Why Cloudflare Zaraz Matters
Third-party scripts are the single biggest performance bottleneck on modern websites. Google Analytics alone adds 40-60KB of JavaScript and blocks page rendering. A typical marketing page loads 10-15 third-party scripts, each competing for bandwidth and CPU. Cloudflare Zaraz solves this by moving third-party tool execution from the browser to Cloudflare's edge network. Instead of the visitor's browser downloading and running analytics scripts, Zaraz processes the data at the edge and sends only the necessary information to the third-party provider. This removes render-blocking scripts, reduces bandwidth, and improves page speed scores dramatically. Cloudflare Zaraz also handles cookie consent management and data privacy Compliance (GDPR, CCPA) automatically, replacing dedicated consent management platforms. For developers managing complex Cloudflare Pages deployments, Zaraz eliminates JavaScript dependency conflicts between third-party tools.
Real-world use: An e-commerce site using Google Analytics, Facebook Pixel, Hotjar, and 5 other marketing tools sees its Lighthouse performance score jump from 45 to 92 simply by moving all tools from browser-side script tags to Zaraz edge-loaded configurations.
How Zaraz Works
flowchart LR
V[Visitor Browser] --> C[Cloudflare Edge]
C --> Z[Zaraz Worker]
Z --> T1[Google Analytics]
Z --> T2[Facebook Pixel]
Z --> T3[Custom Tool]
Z --> CM[Consent Manager]
CM --> Z
style C fill:#f90,color:#fff
style Z fill:#f90,color:#fff
Setting Up Zaraz
Zaraz is available from the Cloudflare dashboard. Enable it for your domain and configure your first tool.
# Step 1: Enable Zaraz
# Cloudflare Dashboard > Zaraz > Enable Zaraz
# This creates a Zaraz Worker that runs on your domain
# Step 2: Add your first tool
# Click "Add Tool" and select from the catalog
# Available tools include:
# - Google Analytics (GA4)
# - Facebook Pixel
# - Google Ads
# - Hotjar
# - HubSpot
# - 400+ pre-built integrations
# Step 3: Configure Google Analytics as an example
# Tool: Google Analytics
# Settings:
# Measurement ID: G-XXXXXXXXXX
# E-commerce tracking: Enabled
# Page views: Automatic
# Expected behavior: Zaraz sends page view events
# to Google Analytics from the edge. No GA JavaScript
# is loaded in the visitor's browser.
Custom Tools Configuration
If your tool is not in the catalog, create a custom HTTP request tool that sends data to any endpoint.
# Add a custom tool:
# Tool Type: HTTP Request
# Name: Custom Analytics
# URL: https://analytics.example.com/collect
# Method: POST
# Headers: Content-Type: application/json
# Body: { "event": "pageview", "url": "{{ client.url }}" }
Expected output: Zaraz sends a POST request to your custom endpoint with the page view data whenever a visitor loads a page. The visitor's browser never executes JavaScript from your analytics provider.
Zaraz Page Rule Exclusions
You can configure Zaraz to load only on specific pages using page rule-like patterns.
# Example page triggers:
# Rule: /checkout/*
# Action: Load Facebook Pixel (track purchases)
#
# Rule: /blog/*
# Action: Load GA4 only (no marketing pixels)
#
# Rule: /admin/*
# Action: Load no tools (exclude internal pages)
Performance Impact
Zaraz dramatically reduces the performance cost of third-party tools.
# Before Zaraz (browser-side scripts):
# Total third-party JS: 850KB
# Render-blocking requests: 12
# Lighthouse Performance: 48
# After Zaraz (edge-loaded):
# Total third-party JS: 0KB (loaded at edge)
# Render-blocking requests: 0
# Lighthouse Performance: 92
Common Errors
| Error | Cause | Fix |
|---|---|---|
Tool not firing |
Trigger condition not met | Check trigger rules; verify the page URL matches the trigger pattern |
Consent required |
Consent manager blocking tool | Configure consent categories; ensure tool has required category assigned |
Data mismatch |
Google Analytics shows fewer visits | Zaraz sends server-side events; some bot filtering differs from browser-side measurement |
Custom tool timeout |
Endpoint too slow | Set a lower timeout or optimize your endpoint response time |
Tool configuration missing |
Required field left empty | Review the tool settings; all marked fields must be filled |
Practice Questions
- How does Cloudflare Zaraz improve page performance compared to loading third-party scripts directly in the browser?
- What happens when a visitor's browser blocks third-party cookies if you use Zaraz?
- Can Zaraz be configured to load different tools on different pages of your site?
FAQ
Summary
Cloudflare Zaraz moves third-party tool execution from the browser to the edge, eliminating render-blocking scripts, improving Lighthouse scores by 30-50 points, and simplifying consent management. With 400+ pre-built integrations and custom tool support, it replaces both Google Tag Manager and dedicated consent management platforms in a single edge-based solution.
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro -- security-first tools for the modern web.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro