The tiny URL code your attribution depends on (don’t lose it)
Published September 6, 2026
The 60-second version
- GCLID and FBCLID tie a click to an order. Lose the parameter and the platform can’t credit the sale.
- Click IDs die in four places: redirects, consent banners, cross-domain hops, and short cookie windows.
- The fix: store the click ID on the order record, and recover the rest with server-side APIs.
Every attribution argument between marketing and finance rests on an invisible snippet of text at the end of a URL. When someone taps an ad, Google attaches ?gclid=abc123 and Meta appends ?fbclid=xyz789. If that snippet survives all the way to checkout, your database knows exactly which campaign drove the sale. If it gets dropped along the way, the customer still pays ₹4,500, the bank account still receives it — but your reports credit the sale to "Direct / Organic".
Most growth teams ignore click IDs until half their ad revenue vanishes into unattributed traffic. Here is how click IDs work, the four places they break, and the server-side setup that preserves them.
A click ID is a temporary receipt for your visitor
The Life of a Click ID
Data JourneyAd click
Google appends gclid, Meta appends fbclid to the landing URL. This is the only shared key between platform and store.
Site journey
Redirects, consent banners, and domain hops each risk stripping or dropping the query parameter before checkout.
Order row
Writing the ID onto the order row gives every purchase permanent attribution. If dropped, attribution is lost forever.
A click ID is not a cookie, not a tracking pixel, and not a permanent profile. It is a single-use digital receipt issued by the ad platform. Its entire job is to let your database tell Google or Meta weeks later: "Order 88412 belongs to receipt abc123."
The one-line distinction: UTM tags tell you where traffic came from. Click IDs let the ad platform match your customer order back to the exact auction, search keyword, and creative. You need UTMs for your internal reports; you need click IDs so ad algorithms can learn from real revenue.
Which click ID belongs to which ad platform
You do not need to configure anything in your ad accounts to generate these IDs. They arrive automatically whenever someone clicks an ad. Your only responsibility is to capture and save them.
| Click ID | Platform | Traffic types | Lifespan notes |
|---|---|---|---|
gclid | Google Ads | Search, Shopping, YouTube, Display | Standard click ID; stored in cookies but subject to Safari ITP 7-day limits |
gbraid / wbraid | Google Ads | iOS app clicks (gbraid) and iOS web clicks (wbraid) | Aggregated privacy identifiers that protect individual user identity |
fbclid | Meta Ads | Facebook and Instagram outbound links | Automatically appended on outbound taps; frequently stripped by privacy browsers |
msclkid | Microsoft Ads | Bing Search and Microsoft Audience network | Identical mechanics to gclid with lower volume |
ttclid | TikTok Ads | TikTok video campaign clicks | TikTok's native click identifier for web events |
Four places where click IDs quietly disappear
1. Redirect chains and link shorteners
Every redirect between the ad click and the final page is a chance to lose query parameters. A URL passing from tracking template to shortener to CMS redirect often sheds its parameters at the first hop that fails to forward the query string. Test this quarterly with one live click per channel.
2. Consent banners and domain hops
Many tag setups only write the click ID into storage after a visitor clicks "Accept" on a cookie banner. If a shopper ignores the banner, browses, and buys, they arrive at checkout with no stored ID. Saving the raw URL string into first-party storage at initial page load is a first-party act that preserves the ID before consent prompts.
Similarly, if your storefront lives on store.com but your checkout lives on checkout.platform.com, the click ID vanishes unless your site explicitly passes URL parameters across the domain hop.
3. Link-decoration stripping
Privacy browsers like Safari and Firefox actively strip tracking codes like ?fbclid= from URLs shared in private browsing, emails, or chat applications. The browser treats tracking codes as unwanted decoration and snips them off before the landing page loads. This traffic cannot be recovered at the URL level, which is why server-side APIs are essential.
4. Cross-device shopping journeys
A customer discovers your product on their phone during a commute, but completes the purchase on their desktop laptop that evening. No URL parameter can jump between two physical devices. Recovering attribution across devices requires hashed customer identity (email or phone) matched through server-side APIs.
The 40% direct-traffic mystery
Store the click ID directly on your order record
The most durable attribution improvement you can make is saving click IDs into your own database:
- On initial page landing, read
gclidandfbclidfrom the URL and save them into a first-party browser cookie or local storage. - At checkout, pass these stored values into custom order attributes or metafields.
- In your warehouse, join orders back to ad platform exports using the captured ID.
Stop data loss with server-side conversion APIs
Even when you store click IDs cleanly, browser ad blockers and cross-device journeys still drop 15% to 40% of browser events. Server-side APIs — Meta's Conversions API (CAPI) and Google's Enhanced Conversions — send purchase events directly from your server alongside hashed email and phone identifiers.
Browser Pixel vs Server-Side API
Reporting HierarchyBrowser pixel
Simple and client-side, but vulnerable to ad blockers, ITP timeouts, and privacy browsers.
Server-side API
Transmits verified orders directly from your backend using hashed customer identity.
Both, deduplicated
Send both browser and server events with an identical event_id so the platform merges them.
Deduplication is where implementations frequently fail:
You send an order through both the browser pixel and Meta CAPI, but the two events have different event_id values. What happens?
To eliminate lost attribution across your funnel, execute these steps in sequence:
Kill the unattributed share, in order test one live click per channel
- Forward click IDs across every domain hop from shop to checkout to payment
- Persist gclid and fbclid to first-party storage immediately upon visitor landing
- Write the click IDs directly onto the order row at checkout
- Add CAPI plus Enhanced Conversions with a shared event_id for deduplication
Frequently asked questions
Do I need a developer to capture click IDs?
Setting up click ID capture typically takes a developer less than a day. Capturing the URL parameter on landing requires a small JavaScript snippet, and modern e-commerce platforms (like Shopify, WooCommerce, or custom backends) offer native fields or metafields to store values on orders.
Does server-side tracking bypass cookie consent?
No. Server-side tracking changes the delivery pipeline (server-to-server instead of browser-to-server), not legal consent rules. Consent preferences must still govern what data your server transmits to ad platforms.
Will platform numbers match my database once click IDs are saved?
They will be much closer, but never identical. Click IDs resolve the identity gap (which click drove which order). The remaining gaps — such as attribution windows, view-through credit, and modeled conversions — are mathematical differences. Expect discrepancies to shrink from 1.4x down to roughly 1.1x. Use MER as your overarching executive metric.
Can we send offline sales back using click IDs?
Yes. Storing click IDs on your CRM leads or orders allows you to upload offline conversion imports weeks later, giving Google and Meta the exact auction signals needed to bid on high-value buyers.
Takeaways for your next report
- Click IDs are single-use receipts that connect an ad click to an eventual database purchase.
- Redirect chains, consent banners, and domain hops are the primary reasons click IDs get lost.
- Saving gclid and fbclid onto order rows gives your warehouse permanent, first-party attribution.
- Always use a shared event_id when running browser pixels and server APIs together to prevent double-counting.
Blended CAC Calculator
Total spend across every channel, divided by total new customers — the acquisition cost number that reconciles with what you actually spent.
Chinmay Raibagkar
About author →Founder of DataLens AI. He helps non-technical teams read their ad and database numbers with confidence — which number to trust, what to do next, and what to ignore.