Analysis: Missing Google Click Identifier (GCLID) in GA4 BigQuery
GCLID is essential for joining Google Analytics 4 data with Google Ads data in BigQuery. Sometimes it is missing and even the well-known page_location bug fix does not help.
About GCLID
The Google Click Identifier (GCLID) is a unique parameter added to the page URL when a user clicks on your Google Ads ad. This identifier helps track the entire user journey from ad click to conversion. It is a key for joining GA4 data with Google Ads data in BigQuery.
Example:
gclid=Cj0KCQjwpvK4BXxxxxxXXXxx_hFaeqRXXXXxxxItigrCiGWtBMoCVR1kooxxxxxxxxxxxxxxxxxx
GCLID is stored in a GCL_AW_P cookie, or an FPGCLAW first-party cookie (if Google Ads Conversion Linker is published in the Server-side GTM).
There is a geeky in-depth article from Simo about Google Ads Conversion Tracking With Server-side Tagging In Google Tag Manager.
GCLID in BigQuery
In BigQuery, the GCLID is (not always!) automatically present in the collected_traffic_source.gclid record.
So tracking it with Google Tag Manager as a custom parameter is generally not required. However, there is a specific scenario where it becomes essential. We're going to focus on this.
Read more about this record in the official GA4 BigQuery export documentation.
Missing GCLID
There is a known bug where the GCLID does not appear in the BigQuery collected_traffic_source record. However, it can be extracted from the page_location parameter. Read more about the fix from Johan.
It may also happen that the GCLID is not passed to other URLs as you can see below in the article.
Query and results
With the Explore in Looker Studio feature in BigQuery, we can quickly and efficiently analyze GCLID in an intraday table using a super simple query.
I simulated the paid ad visit from search and engaged with several events, so I could verify whether the GCLID was properly recorded.
Note:
If you don't have an active streaming export to BigQuery, it is necessary to wait until the next day before the data can be viewed.
Query:
SELECT * from `analytics_XXXXX.events_intraday_XXXXXXXX` -- or daily export analytics_XXX.events_*
WHERE user_id = 'defcb2ed' -- insert your User ID, or use user_pseudo_id
Results (event_gclid is a custom parameter)
What happened?
Data in the table shows that after clicking on a paid Google Search advertisement, I landed on a specific product page.
The page_view event includes the GCLID in the automatically generated GA4 BigQuery schema record collected_traffic_source.gclid. However, in all other events is null.
GCLID is also missing in the page_location parameter. Therefore, attempting to resolve the known bug by pulling the GCLID from the page_location will not work.
This happens because passing the GCLID parameter through URLs is disabled. Linking on all page URLs was causing serious problems for the site and had to be disabled.
So GCLID is extracted from the GCL_AW_P cookie and sent with each event in the custom parameter event_gclid.
Note that you cannot register the gclid parameter in GA4. You can send it to GA4, but it won't show up in the BigQuery with e-commerce events.
Summary
This is a clear demonstration of how we can quickly analyze data, such as User ID, automatic records, and consent mode, along with the sequence of events in which they were triggered. If needed, in near real-time.
To analyze the data in Looker Studio, we need a simple query, filters, and a table.
Hey Roman! I simply read the article. I got two questions if you allow me:
1 - In what situations this will occur or is prone to occur?
2 - Do you know if, after a login on a website from a user who landed on a page via a ppc campaign, the GCLID/UTM parameters get lost? Thanks