This guide shall help you understand how event tracking works in Google Analytics 4 (GA4) and how you can implement it with or without the Google Tag Manager.
Events are user interactions with your website or app. So every report in GA4 is a different visualisation of the events collected. The most common event is page_view, which gets usually triggered every time a site is loaded.
One of the main advantages of GA4 compared to Universal Analytics (UA) is the flexibility of event tracking. In UA, you only had four different parameters to enrich your events with:
In GA4, you can add custom dimensions to your events, so you don’t need to try to fit everything in these fixed parameters.
There are three different categories of events in GA4:
If you plan to implement a new event, you should always check whether the event is an automatically collected event or recommended event before implementing it on your own. With that, you ensure that the data you collected can already be interpreted by GA4 and can be used for pre-defined reports.
Google separates their automatically collected events into two categories:
Both categories are tracked automatically, but for your enhanced measurement, you can choose whether they shall be tracked or not.
There are just three events that are tracked by default:
The Enhanced Measurement Events can be managed in settings -> data streams -> select your data stream.
Here you can enable
You can also check the events that got tracked in “Events”:
Here you can also change the names of the events that get automatically tracked, e.g. if you are unhappy with the naming of “clicks” for outbound links. For that, you can click on “modify events”.
If the interaction you want to track not an automatically tracked event, you can check if it is a recommended event.
Google has put all recommended events together and sorted them by industry. Have a look here:
You see here - besides the event name, which you need to spell exactly the same(!), and a short description - is different Parameters.
These parameters should be used to enrich the event data; in some cases, they also need to be used to have this data available in the corresponding reports, e.g. transaction_id, value and items for the purchase event.
Is your event neither an automatically tracked event nor a recommended event? Then you can implement it as a custom event. With that, you can name the event as you want, and you can also attach custom parameters.
Imaging we are an E-commerce site and want to track purchase events. After we checked the GA4 documentation, we figured out that there is a recommended event for that called “purchase”.
The recommended implementation method (https://developers.google.com/tag-manager/ecommerce-ga4#measure_purchases) to trigger this event is with a dataLayer.push. This gets usually implemented by your IT and will then be pushed once a purchase occurred.
To make sure that the dataLayer.push is implemented correctly, go to your Google Tag Manager and open the preview. Then, after you made a test purchase, the purchase event should be visible in the preview.
To make this event accessible to GA4, you need to add a new GA4 Event Tag.
Make sure to name the event exactly the same and add the parameters.
For each parameter value, you need to add variables, like this for revenue:
Note: The dataLayer-format is in the old UA format to make it accessible to both UA and GA4. If you are just using GA4, you can use the format from the GA4 documentation. To convert the items properly, we used the template “EEC Products -> GA4 items”.
After saving the new purchase event tag, you can trigger a new purchase and make sure that the tag gets triggered in the preview mode:
With this set-up, you can go to the GA4 DebugView and check that the purchase event gets transferred to GA4 and the data is correct.
In this example, we want to trigger an event every time a user clicks on a button called “send email”. For that, we use a custom event.
First, to see what’s happening when someone clicks that button, we check our GTM preview.
Note: If you can’t see the click ID etc., check that you have turned on (Variables -> integrated variables -> configure).
With this information, we can now add a new event tag with a trigger.
You might have seen that we added a custom parameter “target_url” with the value Click URL. After we tested again, like in the example above, that the tag gets triggered and is shown in the GA4 DebugView, we need to register the parameter: custom definitions -> add custom dimension.
The easiest but least powerful event tracking method is in GA4 directly. Go to Events -> create event. For example, you can use this if you want to have an event triggered when a user visits a specific page.
You can test this in the GA4 DebugView directly. For more complex event tracking, it is recommended to use the tag manager.
It is precious to know how to implement event tracking. You can use these for deeper insights, e.g. funnel or path analysis and conversion tracking. Have in mind to always check if the interaction you want to track is already pre-defined by Google before implementing it as a custom event.