Google Analytics 4 (GA4) Recipe
Connect Google Analytics 4 to Cloudflare Zaraz in 1 click for faster pages and accurate e-commerce tracking.
Google Analytics 4 (GA4) Built-in Recipe
Section titled “Google Analytics 4 (GA4) ”Running Google Analytics 4 through Cloudflare Zaraz means your pages don’t load Google’s gtag.js. Zaraz sends events to GA4 from Cloudflare’s servers.
What You Need
Section titled “What You Need”You only need your GA4 Measurement ID (starts with G-, e.g. G-ABC123XYZ4).
Where to find it:
- Open Google Analytics.
- Click the gear icon (Admin) in the bottom left.
- Click Data Streams under Data Collection.
- Click your website stream and copy the Measurement ID.
3-Step Setup
Section titled “3-Step Setup”- Go to WP Zbridge > Zaraz Recipes in your WordPress dashboard.
- Toggle on Google Analytics 4 and paste your
G-XXXXXXXXXXID. - Click Sync to Zaraz (Pro), or Download Container JSON and import it in Cloudflare (Lite).
Once the container is published in Zaraz, GA4 receives your site’s events through Zaraz. Remove any other GA4 tag so page views aren’t counted twice.
Events Tracked Automatically
Section titled “Events Tracked Automatically”WooCommerce actions are sent as Zaraz e-commerce events, which Zaraz converts to GA4 e-commerce events:
| Customer Action | GA4 Event | Details Sent |
|---|---|---|
| Browsing pages | page_view | Page title and URL |
| Viewing a product | view_item | Product ID, name, price, category |
| Adding to cart | add_to_cart | Product details and quantity |
| Removing from cart | remove_from_cart | Product details and quantity |
| Viewing the cart | view_cart | Cart products and value |
| Starting checkout | begin_checkout | Cart products and value |
| Choosing a payment method (Pro) | add_payment_info | Payment method |
| Completing an order | purchase | Transaction ID, value, tax, shipping, coupon, products |
| Refund (Pro) | refund | Transaction ID and refunded amount |
| Searching the site | view_search_results | Search term |
| Submitting a form | generate_lead | Form ID and form plugin |
Engagement events (scroll, file_download, click and others) are listed in the events matrix.