How GA4's conversion tracking works behind the scenes
Unlike in Universal Analytics, GA4's conversion tracking works through the frontend! These are the implications.
Justus
owntag Founder
published August 16, 2021
Conversions?
Conversions are events that are especially important to you and your business. You might track lots of different events like
- File downloads
- Newsletter subscriptions
- Free trial registrations
- Purchases
but maybe only the latter might be so important to you that you want to keep a close eye on it.
Those important events are conversions.
Obvious examples like purchases are important to everyone, but in most cases you will have to define yourself what you consider a conversion.
Universal Analytics
When you create a goal in good old Universal Analytics, you define rules like these in the View Settings:
GA4 conversion definition
Conversions exist in Google Analytics 4 as well. Definiting them is even simpler here, you just go to the Configure section and under Events toggle the conversion status for the events you’re interested in:
As a result they’ll count towards the Conversions metric in your reports where you can measure them all in sum or individually:
The big difference: Processing
Universal Analytics will determine whether a conversion happened on their server when they process your incoming data. If a hit matches the criteria you defined, that counts as a conversion and your Goal Completion metrics are incremented. Closed off and hidden from view, in the black box that is Universal Analytics.
In Google Analytics 4, the decision whether an event is a conversion, happens in the browser.
When you mark an event as a conversion in the GA4 UI, it doesn’t actually change how that event is processed in GA’s backend.
Instead it changes the data stream specific gtm.js file so that whenever such a conversion event occurs, it attaches the _c=1
parameter to the event. And that is what makes it show up as a conversion in the reports.
You can actually see it for yourself when you look at the code of your gtag.js:
My problem: Events worked fine, but no conversions reported
I only realized this logic a while back when I had a tough problem: I had marked an event as a conversion. Even though it was tracked normally and would count as an event, it just wouldn’t show up in any of the conversion reports!
The setup:
- GA4 with a pageview and a few simple events
- Implemented with a client side GTM
- Server side Google Tag Manager container serving gtag.js through first party subdomain.
The solution
I wasn’t loading the proper gtag.js! I thought it was clever to literally load https://www.googletagmanager.com/gtag/js?id=G-1234567890 instead of using my actual Measurement ID. I would then override the placeholder ID in my server side container in order to keep the real Measurement ID a secret.
It seemed to work just fine, but it really loaded the specific gtag.js of the non-existent Data Stream G-1234567890 which didn’t contain any of the configuration I had done. The customizations I configured for my the events (including marking them as conversions) didn’t reach the client / browser through the gtm.js
In the end I simply abandoned the idea of hiding the Measurement ID from the client and loaded the gtag.js with the proper id
parameter and conversion tracking started working as expected.
Become a Server Side Tagging Pro with owntag
Take control of your digital data collection with Server Side Tagging and Server Side GTM – easily hosted with owntag.