Sub topic 5
Auto-tagging and the gclid parameter
This chapter assumes you can already open GA4 Admin and Google Ads, and that you know what a landing page URL and a query string are. It also assumes the GA4 property is linked to the Google Ads account (covered in the previous chapter). Here you will learn what auto-tagging does, how the gclid parameter travels through your site, and how to find the cases where it silently breaks.
What auto-tagging does
Auto-tagging is an account-level setting in Google Ads. When it is on, Google Ads appends a parameter named gclid (Google Click Identifier) to the final URL of every ad click. For example:
https://www.example.com/shoes?gclid=EAIaIQobChMI_example123The gclid value is an encoded token. It identifies one click and carries information about the campaign, ad group, keyword, and creative that produced it. You cannot read it by eye, and you should not try to parse it yourself.
GA4 reads the gclid on the landing page and uses it to look up the ad click details. That lookup is what fills the Google Ads dimensions in GA4 reports, such as campaign, ad group, keyword, and search query. Without it, GA4 only sees the generic traffic source.
Why the link is not enough
Linking the property and enabling auto-tagging are two separate steps. They do different jobs:
| Setting | Where | What it does |
|---|---|---|
| Product link | GA4 Admin, Product links | Allows GA4 and Google Ads to exchange data |
| Auto-tagging | Google Ads account settings | Adds `gclid` to ad click URLs |
| Link option "Enable auto-tagging" | Shown during link setup | Turns on auto-tagging for you at link time |
If the link exists but auto-tagging is off, GA4 still receives the visits. It cannot attribute them to a campaign by gclid. The visits usually fall into google / cpc only when you add manual UTM parameters, and otherwise may appear as organic or direct.
How the data flows
Two points matter here. First, the GA4 tag must actually run on the landing page, and it must run before the visitor leaves or the gclid is lost. Second, the gclid must still be in the URL when the tag runs. Anything that strips or rewrites the query string before that moment breaks the chain.
Turning auto-tagging on
- In Google Ads, open Admin, then Account settings.
- Expand Auto-tagging.
- Select Tag the URL that people click through from my ad.
- Save.
If your GA4 link was created with the "Enable auto-tagging" option selected, this is already done. Check anyway, because someone may have turned it off later.
You can also set it at the manager account (MCC) level in some setups. A change at one level can be overridden at another, so check the specific account that runs your campaigns.
Checking that it works
Click one of your own ads, or paste a test URL with a fake gclid such as ?gclid=test123, and look at the address bar after the page loads. A fake value only proves the URL survives. It does not produce real attribution, because GA4 cannot resolve a made-up token.
To confirm real attribution:
- Click a live ad in a normal browser window (be aware this costs you a click).
- Open GA4 Reports, Realtime and check that traffic appears.
- After processing time, open Reports, Acquisition, Traffic acquisition and set the dimension to Session Google Ads campaign. Your campaign should appear.
Reports in GA4 can lag by several hours. A missing campaign right after the click is not yet a failure.
Common failure modes
Redirects that drop the query string
A server-side redirect, such as http to https, or a non-www to www rule, may drop the query string. The browser lands on a clean URL and the gclid is gone. Test every redirect path by loading a URL with ?gclid=test123 and checking that the parameter is still present after the redirect finishes.
Landing pages that rewrite the URL
Single-page applications and some consent tools update the address with history.replaceState before the GA4 tag fires. If your code removes unknown parameters for cleanliness, the tag never sees the gclid. Let the GA4 tag run first, or leave the parameter in place.
Consent and cookies
When consent for analytics storage is denied, GA4 limits what it stores. The gclid can still be passed in the URL, but attribution depends on your consent configuration and on cookies that may not be set. The consent chapter in this tutorial covers this in more detail.
Third-party tracking templates
If you use a tracking template or a final URL suffix in Google Ads, make sure it does not overwrite or duplicate parameters. A third-party click tracker in front of your site must forward the gclid to the destination.
Manual UTM tags overriding auto-tagging
If your ad URLs also contain utm_source, utm_medium, and utm_campaign, GA4 may prefer the manual values over the auto-tagged ones. The related setting is Allow manual tagging to override auto-tagging in the linked Google Ads settings for the property. By default, auto-tagging wins. If you turn the override on, your UTM values replace the Google Ads values, and the Google Ads campaign dimensions can stop matching.
Ads that lead to another domain or a different property
If the ad lands on a domain that is not covered by the GA4 data stream, the click is recorded in Google Ads but never in GA4. Check that every landing domain uses the same web data stream, or a stream in a property linked to the same Ads account.
Inspecting the gclid in the BigQuery export
Once the BigQuery link is on, you can see how many sessions arrived with a gclid. The export keeps click identifiers in the collected_traffic_source record on each event, and the query below counts sessions by whether a gclid was present on the first event. The field is available only in exports from the date GA4 added it to the schema, so older tables return nulls.
SELECT
event_date,
COUNTIF(collected_traffic_source.gclid IS NOT NULL) AS events_with_gclid,
COUNT(*) AS all_events
FROM `my-project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN '20250101' AND '20250131'
AND event_name = 'session_start'
GROUP BY event_date
ORDER BY event_date;A sudden drop in events_with_gclid while ad spend stays flat points to a redirect or consent change that began on that date.
Where gclid does not appear
Some visits do not carry a gclid even though they come from Google Ads:
- Clicks from iOS apps that limit URL parameters may use
wbraidorgbraidinstead. These are privacy-preserving identifiers for app-to-web and web-to-app traffic. - Visits from Google Ads campaign types that do not click through to a URL, for example some app campaigns, are attributed through other means.
- Users who copy the landing URL without the query string and open it later will arrive as direct or organic traffic.
GA4 handles wbraid and gbraid automatically when auto-tagging is on. You do not need to configure them.
Quick diagnosis checklist
- Is the property linked to the correct Google Ads account in Product links?
- Is auto-tagging on in that Google Ads account?
- Does a test URL with
?gclid=test123keep the parameter after every redirect? - Does the GA4 tag fire on the landing page before any script removes the parameter?
- Is Allow manual tagging to override auto-tagging off, unless you want that behavior?
- Does the landing domain belong to a GA4 data stream in the linked property?
Exercise
Your GA4 property is linked to Google Ads, and campaigns spend money, but the Traffic acquisition report shows the visits as "Direct". Auto-tagging is on in the Ads account. Name two likely causes you can test with a URL containing ?gclid=test123.
Show answer
First, a redirect (for example http to https or non-www to www) may strip the query string, so the gclid is gone before the page loads. Second, a script on the landing page may rewrite or remove the URL parameters before the GA4 tag fires. In both cases, load the test URL, then check whether ?gclid=test123 is still in the address bar once the page has finished loading.
Exercise
Why does a fake gclid such as test123 not prove that attribution works end to end?
Show answer
GA4 resolves a gclid by looking up the real ad click it identifies. A made-up value matches no click, so it shows only that the parameter survives redirects and page scripts. To prove attribution, click a live ad and check the Google Ads campaign dimension in the reports.