How to Setup Google Analytics 4 with Cloudflare Zaraz

Learn how to implement Google Analytics 4 tracking efficiently via Cloudflare Zaraz while preserving user privacy and without affecting site loading speed.

Abhishek

Monday, June 10, 2024

Setup Google Analytics 4 with Cloudflare Zaraz
Setup Google Analytics 4 with Cloudflare Zaraz
Setup Google Analytics 4 with Cloudflare Zaraz

Cloudflare Zaraz is a privacy-focused tool that helps website owners like you implement analytics tools like Google Analytics 4 without needing Google Tag Manager (GTM). By eliminating the need for extra code from GTM, Zaraz can potentially improve website loading speeds. Let’s See how to set up Google Analytics 4 with Cloudflare Zaraz.

What is Cloudflare Zaraz?

Cloudflare Zaraz is a tool that allows you to have complete control over third-party tools and services for your website. Transferring these tools and services to Cloudflare’s edge can significantly improve your website’s speed and security.

With Cloudflare Zaraz, you can load various tools, such as analytics tools, advertising pixels, scripts and more, in the most optimized way possible. This means that your website will be faster, more secure, and more efficient overall.

Why implement Google Analytics 4 with Cloudflare Zaraz?

1. Easy 1 Click Implementation

Cloudflare Zaraz makes it super easy for webmasters to implement the Google Analytics code with just a click.

2. Loads Google Analytics Script on the cloud

Google Analytics scripts include a javascript global site tag that can add ~50Kb to each page load, potentially slowing down your site’s page load speed.

If you want to determine the loading time of third-party scripts on your website, like Google Analytics or Tag Manager, you can scan your website using GTmetrix and check the waterfall chart.

Cloudflare Zaraz loads the GA4 Script on the cloud, which doesn’t affect your site’s speed loading issue. Hence you don’t have to worry about the page speed issue caused by the Gtag Script.

Cloudflare

3. Makes Consent Management Easy:

If your website serves content to EU residents, then you have to comply with Google’s new regulations, which require explicit user consent for data processing and personalized advertising.

Zaraz consent management platform makes it super easy to implement consent management on your website.

Let’s see how to implement it,

Before we begin, I hope you have already set up your domain with Cloudflare.

How to setup Google Analytics 4 in Cloudflare Zaraz

Step 1: Open your Account in Cloudflare

Go to Zaraz and click on Tools configuration and select Google Analytics 4.

Step 2: Grant Permission

Server Network Requests: Turn it onClient network requests: Turn it onExecute client-side javascript: turn it onAccess client key-value store: – turn it on

Step 3: Setup

  • Measurement ID: Enter your GA4 Measurement ID.

  • Hide Originating IP Address: Turn it on if you are going to serve EU region audience.

  • E-commerce tracking: If you have an e-commerce website, turn it on. Otherwise, keep it off.

  • Google Analytics Audiences: Turn it on. This allows you to create audience segments in your GA4 based on the behaviour of visitors on your website.

Step 4: Tool Action

Firing Trigger: Select Pageview and click Save.

That’s it. You have set up Google Analytics 4 via Cloudflare. Now, visit your Google Analytics account and check if the pageview event is coming or not.

You can also create custom triggers to send other events to GA4 like, Button click, form submit etc.

I hope you found this post helpful. Feel free to ask any questions in the comments. How did you add the Google Analytics code to your website? Let me know in the comments!

Get in touch.

Interested in discussing anything related to growth marketing, projects, or just saying hi? Let's connect!

©2024 Growthlity crafted with 🧡 from Uttarakhand, India

Get in touch.

Interested in discussing anything related to growth marketing, projects, or just saying hi? Let's connect!

©2024 Growthlity crafted with 🧡 from Uttarakhand, India

Get in touch.

Interested in discussing anything related to growth marketing, projects, or just saying hi? Let's connect!

©2024 Growthlity crafted with 🧡 from Uttarakhand, India