How to fix the major GA4 BigQuery export misattribution (part 3: use the 'session_traffic_source_last_click' record)
In July 2024 a new record was added to the GA4 BigQuery schema: session_traffic_source_last_click. In this tutorial I will show you how to query this record and, as a positive by-effect, fix the major google / cpc misattribution bug in the GA4 export.
In July 2024, a new record was added to the GA4 BigQuery schema: session_traffic_source_last_click
. This records contains session-scoped traffic source information, using the same last non-direct click attribution found in the GA4 UI.
In this tutorial I will show you how to query this record and, as a positive by-effect, fix the major google / cpc
misattribution bug in the GA4 export.
google / cpc
misattribution for your historical data.Record exploration
First, let's explore the fields that have been added to the schema.
The record session_traffic_source_last_click
contains two subrecords:
manual_campaign
google_ads_campaign
The first subrecord session_traffic_source_last_click.manual_campaign
contains values similar to those in the collected_traffic_source
record. The difference is that the values in session_traffic_source_last_click.manual_campaign
are session-scoped and use the last non-direct click attribution model, where collected_traffic_source
are event-scoped and no attribution model is applied.
The second subrecord session_traffic_source_last_click.google_ads_campaign
contains valuable information about Google Ads traffic that was not previously included in the GA4 BigQuery export.
It contains the following fields:
customer_id
account_name
campaign_id
campaign_name
ad_group_id
ad_group_name
Or as Google states it in the GA4 release notes:
We've added a new record to the GA4 BigQuery Event export that contains the Google Ads and Manual campaign context information for each session present in the export. This information is repeated for every event in a session to enable fast and easy channel analysis in BigQuery of any event within a session. The exported data is the same as the data used in GA4 behavioral reporting. (source)
Unfortunately, for the events where session_traffic_source_last_click.google_ads_campaign
shows that (according to the last non-direct click attribution model) the traffic source is a Google Ads campaign, the values for session_traffic_source_last_click.manual_campaign
will still be attributed to google / organic
or other non-Paid Search channels.
First, I'll show you how to query both records, and then how to apply a fix so that your last non-direct click traffic information should more or less match the numbers in the GA4 user interface.