How to fix the major GA4 BigQuery export misattribution (part 1: overwrite source, medium & campaign when 'gclid' parameter is available)
How to fix a bug in the GA4 export when a page view event is generated from a Google search ad and the event includes a paid search gclid parameter in the page url, but the event is still attributed to organic or direct traffic.
One of the most annoying bugs in GA4 (at least for users of the GA4 data export) is the incorrect attribution of event traffic data. The issue occurs when a page view event is generated from a Google search ad and the event includes a gclid
parameter in the page url, but the event is still attributed to organic or direct traffic.
As long as you stick to the default traffic_source
fields (first user source, medium and campaign) then the traffic source information is correct. But when you query event or session level traffic acquisition fields, like channel grouping, source, medium and campaign, the misattribution will heavily affect your results.
Example: before and after
For example, compare these two results above. You see the result of two queries against a GA4 property that contains Google Ads traffic (using auto tagging). Before the fix none of the sessions with a gclid
in the page_location
were attributed to paid search. After the fix we can conclude that in this specific case 33% of all sessions (!) should in fact be attributed to google / cpc
.
This percentage will differ in each data set, but based on various reports a misattribution of 10-30% of all sessions is no exception.
Although this bug is known for quite a while now, unfortunately Google didn't put any effort in fixing it. Let's see what we can do ourselves then.
In this tutorial I will show you how to create a workaround, so your session based traffic source acquisition queries will at least be attributed to the right source and medium and default channel group Paid Search
.
Cross-network
. Unless you set up the Google Ads Data Transfer, then I'm happy to present you part 2 of this tutorial: learn how to join GA4 with Google Ads data (using the 'gclid' parameter as join key) and get your campaign data right.Update: From July 2024 onwards there is another possible fix, using the
session_traffic_source_last_click
record. Read all about it in part 3.If this is not an option, see this helpful article for inspiration on a possible workaround by sending custom parameters to GA4 and leveraging those in BigQuery.