GCLID affiliate tracking: keep Google's click ID alive from ad to sale
November 28, 2026 · Hoplytic team · 5 min read
Read the video transcript
How do you keep the gclid attached, from the ad all the way to the sale?
Google adds the gclid to your landing page URL. They click your affiliate button. Your tracking link stores the gclid beside its click ID, and the network only gets that ID. The sale comes back, and the tracker uploads the conversion.
The gclid sits in your page's address bar, so something has to carry it to the click.
Most robust: store the gclid in your site's browser storage when the visitor lands. Then add it to tracked links on any page they click. A script that appends it on page load works for the first page only.
Don't put the gclid in the sub-ID. Networks cut long values, and a cut gclid matches nothing.
Gclids get lost when auto-tagging is off, or a redirect drops the query string. Test the chain with a fake gclid in a redirect checker. Keep it at least ninety days, and never edit it.
Hoplytic stores the gclid, gbraid and wbraid with every click. The site script keeps them seven days and adds them to tracked clicks. The Google Ads feed lists gclid sales from the last ninety days. gbraid and wbraid clicks are stored but not in it.
The full guide is right below. Hoplytic: ad tracking made simple.
Key points
- The gclid lands on your page, not on the affiliate click, so something has to carry it from the landing page to the outbound link.
- Don't send the gclid itself to the affiliate network; store it with your own short click ID and send that in the sub-ID.
- Most lost gclids are caused by redirects, link shorteners, caching or forms that drop the query string, and all of them can be tested.
- Some iOS traffic arrives with gbraid or wbraid instead of a gclid, and those clicks need different handling when you upload conversions.
- Measure the share of your Google-sourced sales that carry a gclid; that share is the ceiling for what Google can learn from.
Every Google Ads click carries a click ID, the gclid, and it is the only key Google accepts for crediting an affiliate sale to the keyword that earned it. The hard part isn't uploading the sale. It's keeping that ID attached to the visitor all the way from the ad, through your page, to the network's sale report.
Short answer: keep auto-tagging on, capture the gclid on your landing page, carry it to the moment the visitor clicks your affiliate link, and store it in your tracker next to your own short click ID. Send only your click ID to the network as the sub-ID. When the sale comes back, the tracker looks up the gclid and uploads the conversion to Google.
Uploading is covered in Google Ads offline conversion import, and the tracking template in Google Ads click tracker. This guide is about the gclid's journey.
The journey of one gclid
- Someone searches "best vpn for travel" and clicks your ad.
- Google adds
gclid=Cj0KCQiA4ab...to your landing page URL:https://yoursite.com/best-vpn?gclid=Cj0KCQiA4ab.... - The visitor reads your page for three minutes and clicks the button for one VPN.
- That button goes to your tracking link, which records the click with ID
c7f3a9e1, stores the gclid next to it, and redirects to the network withc7f3a9e1in the sub-ID. - Two days later the network reports a $32 commission with sub-ID
c7f3a9e1. - The tracker finds the gclid for
c7f3a9e1and adds the sale to the upload for Google.
Step 4 is where most setups break. The gclid sits in the address bar of your landing page. Your affiliate button doesn't have it, unless something puts it there.
Getting the gclid from the page to the affiliate click
Three ways, from least to most robust:
- Send the ad straight to the tracking link. The tracker sees the gclid directly. Simple, but usually not an option: Google's policies on final URLs and many merchants' rules against bidding on their brand mean most affiliates send Google traffic to their own page first.
- Append it with a small script. On page load, read
gclidfrom the URL and add it to each affiliate link on the page. Works for the first page only: if the visitor goes to a second page before clicking, the gclid is gone unless you keep it. - Keep it for the visit. Store the gclid in the site's own browser storage when the visitor lands, and add it to tracked links on any page they click. This survives browsing around your site.
Why not put the gclid in the network's sub-ID?
It's tempting: the network would hand the gclid back with the sale. In practice:
- Length. gclids are long. Many networks cap sub-IDs well below that and cut the value without warning. A cut gclid matches nothing.
- Characters. gclids can contain dashes and underscores, which some networks strip or reject in sub-IDs.
- One slot, many needs. You also want the page, placement or keyword in the sub-ID slots. Spending a slot on a long Google ID crowds them out.
- No other data. With only the gclid, you can't see the keyword, device or page of the sale in your own reports.
A short click ID in the sub-ID, mapped to everything else in your tracker, avoids all four. See click ID tracking.
Where gclids get lost
| Cause | How to check |
|---|---|
| Auto-tagging off | Google Ads account settings. Without it there is no gclid at all. |
| A redirect that drops the query string (http to https, www to non-www, an old URL) | Run your final URL with ?gclid=test123 through the redirect checker and see if it survives every hop. |
| A link shortener or cloaking plugin between the page and the tracker | Click the button with a test gclid and look at the tracker's stored click. |
| A cached page with links baked in | Clear the cache and test in a private window. |
| A form or quiz step that reloads the page without parameters | Walk through the funnel with a test gclid. |
| Clicks from organic search, not ads | Normal. These sales can't be uploaded. |
gbraid and wbraid
On some iOS traffic, Google sends gbraid (for app conversions) or wbraid (for web conversions) instead of a gclid. What that means for you:
- Capture them too. Store gbraid and wbraid with the click the same way as the gclid.
- One identifier per conversion. Google's API takes exactly one of gclid, gbraid or wbraid for each uploaded conversion.
- Slower and less complete. Google says conversions keyed on gbraid or wbraid can take up to 72 hours to process, against under 12 hours typically.
- Check your upload method. Whether a file or scheduled upload accepts these columns depends on Google's current format; check Google's help for the conversion upload template.
If you upload through an API, note that Google announced that offline conversion imports would move from the Google Ads API to its Data Manager API starting June 15, 2026. Check Google's documentation for which one your account should use now. Scheduled file uploads are not affected by this.
Keep it, match it, measure it
- Keep the gclid at least 90 days. Google accepts imports within 90 days of the click; networks with long approval times need all of it.
- Never edit it. No lower-casing, trimming or re-encoding.
- One account. A gclid only matches in the Google Ads account (or its manager account) that served the click.
- Measure coverage. Of your sales from Google traffic last month, how many had a gclid? If it's 60%, Google is learning from 60% of your sales. Fix the leaks above before you blame Smart Bidding.
Related: gclid, fbclid and ttclid compared.
Doing it in Hoplytic
A Hoplytic tracking link stores the gclid, gbraid and wbraid with every click it receives. When Google traffic lands on your own page first, the site script keeps those values in your site's browser storage for 7 days and adds them to the click when the visitor uses a tracked link, while the network only gets Hoplytic's click ID in its sub-ID. Under Send back, the Google Ads feed lists sales from the last 90 days whose click carried a gclid, ready for a daily scheduled upload; clicks with only gbraid or wbraid are stored but not included in that feed.
Questions people ask
Can I put the gclid in my affiliate network's sub-ID?
You can, but it often fails: gclids are long and many networks cut or reject long sub-ID values. Store the gclid in your tracker and send a short click ID of your own to the network, then look the gclid up when the sale comes back.
Why is the gclid missing from my landing page?
Auto-tagging may be off, a redirect or shortener may drop the query string, or the visitor came from an organic result rather than an ad. Click a live ad and check the address bar for gclid=.
What are gbraid and wbraid?
They are Google click identifiers used on some iOS traffic in place of a gclid: gbraid for app conversions and wbraid for web conversions. Google's API takes exactly one identifier per conversion, a gclid, a gbraid or a wbraid.
How long is a gclid useful for affiliate tracking?
Google accepts offline conversion imports within 90 days of the click. Keep the gclid with the click at least that long, and longer if your network approves sales late.
More in Conversion tracking
Also: tracking glossary · ad platform macros · Markdown copy