GA4 secrets: best practices and technical solutions to usage and Google Analytics 4 implementation problems
GA4 can be a very powerful tool, but it’s only useful if implemented properly. Today, we’ll be talking about some GA4 implementation best practices. We’ll talk about some technical solutions to common problems. We will even discuss some ‘secret’ GA4 features that you can make use of.
This is a write-up of the talk by Matteo Zambon at GA4ward MKIII. You can find his slides here, and the recording is below:
GA4 implementation best practices
1. GTM: GA4 tag configuration
Handling GTM: GA4 tag configuration is vital before you can start making use of any GTM features.
The first rule, the GTM tag configuration must always be active before the GTM tag events. It’s a good idea to use the GA4 Configuration Tag on Initialization for all pages. Alongside this, use the specific page view event. So, why are we doing this? What are the problems?
The first problem is the attribution channel. If the configuration is not available before the event, the sessions start to be a problem. The session start is the way to assign the attribution for the session. So you may find you have many unassigned attribution channels.
The second issue is if you use the server-side configuration and you have an event before the configuration, it will be sent without GTM server-side. The event will be client-side with the default end-point for Google Analytics.
So, be careful how you handle configuration. Remember, the configuration tag is the first tag you need to find!
2. Keep track of known and unknown bugs
We released a list of bugs in GA4 so that we could help anyone with GA4 troubleshooting. We’ve put together a collaborative Google Sheet called GA4 bug list.
It’s a good idea to take a look at this GA4 bug list before beginning your GA4 implementation.
Thanks to the Google Sheet and the feedback from the other bug reports, we had a chance to analyse and verify the state of GA4 implementations worldwide. The GA4 community can benefit from this joint effort.
In the image above, you can see Sara has an issue with the attribution of her campaigns. This is due to the handling of UTM parameters which were correct in GA3 but not in GA4.
We decided to run several tests to better understand the GA4 channel attribution mechanism. During this testing, we noticed that the problem could be related to the session start event, which was missing. If the session start is missing in GA4, the GA4 assignment is not as accurate.
After further analysis, we confirmed our theory and asked Sara to verify, and bingo – we were right! The problem was due to the missing session start event.
3. Create a list of custom dimensions
The image below shows a Google Sheet that handles our customer definitions. Our suggestion is to create a list of custom dimensions and use it to improve our analytics and configuration.
The goal is to have a solid structure when defining dimensions and metrics. To achieve this, we use a Google Sheet and the GA4 API. It’s time-consuming to do this manually. Using the API, all you need to do is copy and paste your dimension description and click a button. From there, your dimensions and metrics will be created from your GA4 property.
If you’re unsure how to do this, you can watch this simple guide.
4. Implement custom parameters
Let’s look at some GA4 best practices for implementing custom parameters.
These are parameters that can be added to any event to enrich information. Examples include consent_mode, gtm_container_info, gtm_hit_timestamp, and more.
Dwell time for SEO
Dwell time is the amount of time users spend on a page they find in search results before returning to the SERP. This is an incredibly relevant metric for SEO, helping you to improve content and boost engagement.
As you can see in the image above, for dwell time, we again used several metrics. We’ve used the ‘gtm_hit_timestamp’ and ‘gtm_data_now’ in all events. You’ll notice that we have the same parameters as the value. This is because the value needs to match the configuration.
Page load performance
This is particularly useful for creating your user monitoring reports. Below is an example GA4 implementation for a page load performance report.
Core web vitals
Again, the image shows the configuration for the Webcore vitals reports.
Below is another example of horizontal parameters, this time for a Geolocation report.
4. Use bot identification tools
As well all know, bots are becoming more and more of a problem for digital analytics. This year at Superweek, useful information was shared about combating this issue. If you scan the below QR code, you’ll find information that will help you to create your own bot identifier.
5. Use annotations
We all know that it was best practice to use annotations in GA3. They were a useful tool for gaining extra context on data.
Sadly, though, in GA4, there is a problem. There are no annotation features in GA4. So, what’s the solution?
Solution #1 – Google Sheet & Looker Studio
A simple Google Sheet with dates and notes can be used with Looker Studio. This can blend information so that we can create graphics to better understand our data.
Solution #2 – Using custom events
Using the GA4 event builder, you can create specific custom events for annotations. This will grab information directly from GA4. This way, you don’t have to put data manually into a Google Sheet. You can then input this data into Looker Studio.
6. Fix GCLID attribution
If you use GA4 with BigQuery you probably know that the GCLID attribution is wrong. The issue relates to the source/medium and campaign.
GA attribution reports are largely accurate. This problem applies mainly to BigQuery where campaign and medium are both organic, but we have GLID information. This is an issue with the BigQuery schema and is always present. The solution, thankfully is Google.
We can check the GA session ID and find the issue. We find that we don’t know the campaign name. Of course, this is about the session. Campaign, medium, and source are about the session quota.
Thankfully, in GA4 the report is correct. You can filter by reports and APIs for ga_session_id. By doing so, you can find out the campaign name and source/medium.
You can follow the same method using the API. If you filter by session ID, you can find the information we need. We can see that Google/ CPC is the source and the medium.
In this way, you can use the GA4 API to export the campaign and find the missing BigQuery value.
The image below shows this put into practice. We used the Apps script, but you can use the Google Cloud Function directly in BigQuery. By doing so, we can fix the history data for BigQuery.
What if I don’t have a custom dimension?
If a custom dimension isn’t available to you, you can also use a GCLID parameter. Unfortunately, GCLID is not present in the page path or query string dimension, but it is present in the page location parameter.
If you try to use the API to grab information using page_location and session_campaign you’ll run into problems. This is because you cannot use both dimensions in the same request. In other words, GCLID cannot be used directly in GA4. So, using page location is not the way to do this.
Page location is viable in explorations. You can create an exploration report and filter by gclid. You can then grab information.
Another route, if you don’t use custom dimensions is to use a page referrer. Again, with this method, you can filter by preferred page and use that information to find the campaign name.
Filtering with a custom dimension
If you do have a custom dimension (such as ga_session_id, or gtm_gclid), you can use this to filter. And now, you can blend information directly with BigQuery and GA4/Google Sheets data sources.
Or, alternatively, you can create a Google Cloud Function and export all data to another BigQuery table and join the two tables.
Below are some Looker Studio examples using this method. The first section shows the GA4 data source so that the data is correct.
In the second section, we can see that if we look at data directly in BigQuery, we have a problem with GA4 organic attribution.
If we blend together the Google Sheet API and BigQuery, we have the same result as GA4. This is the best way to grab historical information in BigQuery.
Successfully implementing GA4 isn’t always easy. Hopefully, this guide has helped to illuminate the process for you. By bearing technical solutions for GA4 in mind, you can have the best possible implementation. If you haven’t already, why why not begin your GA4 implementation now?
About Matteo Zambon
Co-Founder and CTO of Tag Manager Italia, a consulting and training company specializing in tracking and digital analytics, Matteo Zambon is an internationally renowned digital analyst and an official Beta Tester of Google Tag Manager. In 2022 he was the first Italian ever to receive two international awards in digital analytics: the “Golden Punchcard Prize” for the software “Tag Chef” as the best digital analytics application and the Quanties Awards – the “Oscars” of digital analytics – for the “Top Analytics Educator” category.
- SEO ROI Calculator & 5 Ways to Improve SEO ROI - 22/02/2024
- How Much Does Google Ads Cost? 2024 Pricing & Examples - 14/02/2024
- 9 Best Enterprise SEO Blogs to Read in 2024 - 07/02/2024