blog.1.image
August 16, 2021

How GA4's conversion tracking works behind the scenes

by Justus

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:

A screenshot of the goal definition in Universal Analytics

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:

A screenshot of Google Analytics 4 showing a list of events and the corresponding toggle to mark them as conversions.

As a result they’ll count towards the Conversions metric in your reports where you can measure them all in sum or individually:

A Google Analytics Report with a column titled Conversions

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.

A screenshot of Google Chrome DevTools' network tab with the _c parameter highlighted in a Google Analytics request

You can actually see it for yourself when you look at the code of your gtag.js:

A screenshot of my gtag.js file where the event with the name example_event is highlighted and the code shows that it's marked as a conversion

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.

Did this article help you?

Then follow me on twitter
@hume_dev
so you won't miss new articles here and for Web Analytics and Marketing technology updates in general :)