Integrating Zaraz - a Privacy focused Tag manager

Zaraz was acquired by CloudFlare and integrated as a Free tool on all projects (This may or may not change). What exactly is Zaraz is best described below...

Cloudflare Zaraz gives you complete control over third-party tools and services for your website, and allows you to offload them to Cloudflare’s edge, improving the speed and security of your website. With Cloudflare Zaraz you can load tools such as analytics tools, advertising pixels and scripts, chatbots, marketing automation tools, and more, in the most optimized way.

Cloudflare Zaraz is built for speed, privacy, and security, and you can use it to load as many tools as you need, with a near-zero performance hit.


Advantages of using Zaraz

  • Privacy first
  • Loads on the edge
  • Changes happen within milliseconds
  • Event tracking is really easy to setup

How to setup Zaraz

  1. Ensure you have a Cloudflare account
  2. Login and navigate to your domain and the menu point Zaraz
  3. Your first step should be to configure the settings. There are a number of important points to consider here, so read through carefully.

Once the above is done, we found it easier to setup triggers, tools then actions.


A trigger defines conditions under which a tool starts an action. The default trigger which is required to fire any tool is the Pageview trigger.

If you setup any analytical tracking script, you will need to add as a minimum the Pageview trigger to record any pageview by the user visiting your website.

There are numerous ways you can use triggers, listed below are a few examples.

  • Matching a specific page path to trigger a chat bot
  • Matching a specific page path to exclude a directory (eg: admin area)
  • Using a click listener to trigger an event
  • Using a form submission to track an event

It is useful to understand all of the properties which can be used in a trigger, view the complete documentation here.

Tools & Actions

Tools are snippets of code you add to Zaraz to perform certain functions. The basic example again is analytics, where you can choose from predefined tools such as GA4. When you create a tool, you then create an Action which then contains the triggers. In the example below you can see that the Action is the Pageview and contains a default trigger Pageview and we have added a blocking trigger to exclude the admin area.

It is important to note that a Tool can contain multiple Actions (ie pageviews, events etc). Actions may also contain multiple triggers, which may fire or block based on your trigger setup.

How to track a button

The screenshots below should be self-explanatory. First we create a trigger which watches the button class .track_contact_en. Then we add an action to the GA4 tool, which sets the firing trigger to track the button click. We also give the event a custom name, so we can track this in analytics.

Zaraz also has tools for

  • Bing
  • Custom HTML
  • Facebook pixel
  • Google analytics
  • LinkedIn
  • Hubspot
  • and many more...

We find that using the HTML tool very useful, as you have the ability to add other tracking scripts, which may not be present in the current tool setup.

Lastly, we find that Zaraz is a great alternative to Google Tag Manager, simply put the loading of 3rd Party scripts does not slow the site down. This is a huge advantage, when site speed is very important in converting users to paying customers.