The tiny URL code your attribution depends on (don’t lose it)

· has debugged attribution that broke at a redirect🔗 with a storage checklist, not a lecture

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.
bottom line: no click ID, no credit — store it on the order

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 Journey
Stage 1ID attached
Ad click

Google appends gclid, Meta appends fbclid to the landing URL. This is the only shared key between platform and store.

landing_url = /?gclid=abc123
Stage 2ID must survive
Site journey

Redirects, consent banners, and domain hops each risk stripping or dropping the query parameter before checkout.

Must survive 3–5 potential drop-offs
Stage 3ID stored or lost
Order row

Writing the ID onto the order row gives every purchase permanent attribution. If dropped, attribution is lost forever.

order.gclid = abc123 — or NULL

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 IDPlatformTraffic typesLifespan notes
gclidGoogle AdsSearch, Shopping, YouTube, DisplayStandard click ID; stored in cookies but subject to Safari ITP 7-day limits
gbraid / wbraidGoogle AdsiOS app clicks (gbraid) and iOS web clicks (wbraid)Aggregated privacy identifiers that protect individual user identity
fbclidMeta AdsFacebook and Instagram outbound linksAutomatically appended on outbound taps; frequently stripped by privacy browsers
msclkidMicrosoft AdsBing Search and Microsoft Audience networkIdentical mechanics to gclid with lower volume
ttclidTikTok AdsTikTok video campaign clicksTikTok's native click identifier for web events

Four places where click IDs quietly disappear

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.

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.

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

Real store turnaround
Paid clicks (monthly)182,000Billed across Google and Meta
Orders with click ID61%Stored on order checkout
Orders marked 'Direct'39%Unattributed revenue
After domain-hop fix88% with click IDForwarded across checkout domain
The marketing campaigns did not change. The store simply forwarded click IDs across its checkout hop and stored them on landing. A quarter of total revenue moved from 'Direct' back to the campaigns that created it.

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:

  1. On initial page landing, read gclid and fbclid from the URL and save them into a first-party browser cookie or local storage.
  2. At checkout, pass these stored values into custom order attributes or metafields.
  3. In your warehouse, join orders back to ad platform exports using the captured ID.
Attach Click IDs to Orders, Then Join Back to Campaigns

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 Hierarchy
Tier 1
Browser pixel

Simple and client-side, but vulnerable to ad blockers, ITP timeouts, and privacy browsers.

Misses 15%–40% of conversions in privacy-heavy traffic
Tier 2
Server-side API

Transmits verified orders directly from your backend using hashed customer identity.

Recovers missed purchases immune to ad blockers
Tier 3
Both, deduplicated

Send both browser and server events with an identical event_id so the platform merges them.

Shared event_id = maximum match rate, zero duplicates

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.

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.
stick this on your Monday report
Free tool

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

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.