How do I re-write all the Google events we fire on our web site so they get reported as events to GA via the Zaraz integration. We are wiring up events as outlined below:
ga(‘send’, ‘event’, [eventCategory], [eventAction], [eventLabel], [eventValue], [fieldsObject]);
I think we would be making zaraz.track calls, but it’s not clear what I would pass in to get these through to GA? Since this is super common I have to assume there is some kind of automatic wiring up of these events from Zaraz to GA?
Yes, you would make a universal
zaraz.track() and configure the appropriate values in the “Triggers” page.
zaraz.ecommerce() has the “automatic wiring” and works nicely, you just make sure you have it enabled in Settings.
As far as I know, everything is sent automatically when the functions are called.
Well since one of the most common uses is for event tracking with GA, I think it’s an oversight to not automatically have that trigger set up? I have set up my own trigger, but the more I have to configure the more painful it is for me to set this up for our sites as I have to replicate the setup across 8 sites.
Is there API support for this stuff so we could build the configuration and manage it via API? That would make it much easier as then we could turn on and off integrations from our back end, and have it do the necessary bits automatically in CF?
Also while the ecommerce() call has automatic writing, it does not have any wiring for events?
It is absolutely not an oversight. How is Zaraz supposed to know what events you want to set up? Events are completely subjective.
Your questions can be answered in the Zaraz documentation. It can help clarify a lot of things.
No, events are not entirely subjective. The data you pass is subjective, but the way to send the data to Google is via a single, consistent API call. Hence the reason that API call should be mapped by default.
I already have my own events configured, but that is just one more step I had to configure and for new users another step they need to figure out if they want to send interactive events to Google.
From my understanding you have all those ga calls hardcoded in your source code, you were not using dataLayer or GTM?
We are providing integration with the dataLayer, as it a shared array, but if I am not mistaken, you would like an integration that replaces all the calls to universal analytics library (ga) to Zaraz, so that whenever you call ga(‘event’, …) this automatically call zaraz behind the scenes, is my understanding correct?
If so, although this is not something we would recommend, as the best practice would be to replace all those calls with proper zaraz.track, for clarity, you could actually build this workaround by overriding the global ga function so that it calls zaraz.track.
Yes, that is exactly what I need and we are not using data layer. And yes, I have already replaced all the calls to zaraz.track calls, but the problem is there is no default translation of zaraz.track(‘event’, blah …) to trigger google events. For that to work I have to set up the event translation myself.
Since the translation is going to be identical for everyone, it stands to reason that this could be supported out of the box for the GA integration? Then I do not need to set up extra stuff to make it work? The one caveat would be passing in nonInteraction: 1, so for that you would want to support that somehow in the zaraz.track() call and translate it to the event. For me, since all our events are non interaction events, I just hard coded it in my event setup.
Part of why I think this is important is to minimize the amount of setup required to get GA working on a property. We have 8 properties we need to configure, so that is a ton more mouse clicks to set things up!
Ideally there would be API support for managing the integrations so I could have it all happen behind th scenes via API and not have to do anything manually. That would be ideal also as then I can leave stuff like the GA account ID’s etc in our back end configuration, and if someone turns it on, it goes out to Cloudflare via the API’s and configures it. If you turn it off, it removes it.
Thank you for the feedback!
Since the translation is going to be identical for everyone, it stands to reason that this could be supported out of the box for the GA integration?
zaraz.track allows you to speed-up your implementation for some aspects of your tracking, the ecommerce part for instance. Once you have translated your ga calls to zaraz.ecommerce, you do not have to setup individual actions in the Zaraz UI, just toggle on the ecommerce support in the tool config and you are all set. Best part is that this also applies for any tool supporting zaraz ecommerce. So let say that you decide later on to use facebook tracking. For the ecommerce part of it, you would not need to setup any ecommerce actions, nor add code to your pages, just add the tool, toggle on the ecommerce API in the Facebook tool settings from the Zaraz dashboard and it will work.
As zaraz calls are used in a transverse way across all tools that listen to it, it is hard from a product pov to provide 1-1 automatic translation with hardcoded ga calls. As mentioned already, we do provide a dataLayer integration that eases migration from other analytics stack to zaraz.
The one caveat would be passing in nonInteraction: 1, so for that you would want to support that somehow in the zaraz.track() call and translate it to the event. For me, since all our events are non interaction events, I just hard coded it in my event setup.
You can set parameters and fields global to a tool, so that it is shared by all actions. For the non-interaction for instance, go in the tools setting, add your non-interaction field set to 1 and it will be applied to every actions, without the need to reference it in every action.
We have 8 properties we need to configure
If they all share the same config, you can leverage the zaraz API to copy the config to multiple zones and avoid the need to use the UI entirely.
Where do I find documentation on the Zaraz API, as that sounds perfect for what we need. Then I can set it all up via the API and toggle tools on and off with our back end and have it automatically configure them in Zaraz. We already do quite a bit with Cloudflare via the API, so just need to get pointed to the docs for it.
You can dig more here:
That is just the API documentation on Zaraz itself. What I am looking for is the configuration API documentation, so I can manage the Zaraz configuration for each domain automatically and not need any manual editing when we launch a new site.
Can’t find anything about Zaraz in the Cloudflare API docs (for some reason I cannot post links?)
https api dot Cloudflare dot com
Zaraz is still in Beta. The further api configurations what you are looking for, I assume are yet to come. You can however clarify with the dev team.