Skip to main content

Tracking

What is twclid?

By the AffBuddy Editorial Team Reviewed & updated July 25, 2026

Quick Definition

twclid — the X Click ID — is a click ID X generates and appends to your destination URL when someone clicks your ad. You parse it from the landing-page query string and send it back with conversion events through the X Conversion API, where it's the only identifier accepted raw and on its own.

Last verified July 2026 against the X Ads API documentation (Web conversions).

The only identifier X takes raw and alone

X's Conversion API requires at least one identifier on every conversion event — but the accepted identifiers are not interchangeable, and the differences decide how you build:

Identifier Hashing Can stand alone?
twclidNone — sent rawYes
Email addressSHA-256 requiredYes
Phone numberE.164, then SHA-256Yes
IP addressNoneNo — must pair
User agentNoneNo — must pair

So twclid is the only one that needs neither hashing nor a second identifier alongside it. Email and phone can stand alone but only after you've hashed them correctly; IP and user agent are never sufficient by themselves no matter how many of them you send.

X's own guidance follows directly from that: "It's recommended to always include Click ID in the conversion request." If you're going to get one thing right on this platform, it's capturing twclid.

conversion_id is a deduplication key, not a conversion ID

This one catches people because the field name actively misleads. conversion_id is not your internal identifier for the conversion — your order number, your transaction reference. It is the deduplication key.

X's instruction is to use the same deduplication key in both the Pixel code snippet and the Conversion API request, passed as conversion_id, so the two paths for the same event collapse into one conversion instead of two.

The failure mode is quiet and expensive: populate conversion_id with an order number server-side while the Pixel sends something else — or nothing — and the values never match. Both events are accepted, neither errors, and every conversion is counted twice. Your reported ROAS doubles and your bidding optimises against fiction.

Rule: generate one value per event, and make sure the browser and the server both send that same value. Same principle as Meta's event_id, covered in Conversion API vs Pixel.

The window X doesn't publish

Every other major platform names a number. Google states it retains gclid for 90 days; Microsoft caps msclkid offline imports at 90; Meta recommends a 90-day _fbc expiry.

X's public web-conversions API documentation states no equivalent limit — no retention period for twclid, no maximum age for conversion_time.

You will see "30-day click-through, 1-day view-through" quoted confidently in third-party guides and connector docs. Those figures do not appear in X's own API reference, so treat them as reported defaults rather than documented guarantees, and check the attribution settings on your actual ad account. This is the same trap as the widely-repeated "ttclid lasts 7 days" claim that TikTok's documentation never makes.

Practical takeaway: in the absence of a published number, store twclid for at least as long as your longest plausible conversion path, and don't design a workflow that depends on an undocumented window holding.

Capturing twclid

  1. On landing. Parse twclid from the query string as soon as the visitor arrives and store it first-party. X's phrasing is to parse it out "when it is available" — it won't be there on organic or direct visits, so handle its absence rather than assuming it.
  2. Alongside the record. X suggests storing the value with the relevant form fields or conversion event information, which is what makes batching and bulk uploads possible later.
  3. At conversion. Send twclid raw in the Conversion API payload, together with a conversion_id that matches what the Pixel sends for the same event.

Common twclid failure modes

  • Mismatched conversion_id. Silent double-counting. The single most damaging mistake here.
  • Hashing it. twclid goes raw. Hashing it makes it unmatchable, and nothing will tell you.
  • Leaning on IP plus user agent. Neither can stand alone; sending only those two is a weak, fingerprint-style match and X's rules require pairing for a reason.
  • Assuming a 30-day window. Undocumented. Don't build a workflow that depends on it.
  • A redirect stripping it. The universal click-ID failure — capture before any hop.
  • Brave. Strips twclid by default for every user — see the Click ID Survival Matrix.

For the wider landscape, see the click ID explainer; for the full build, the tracking-setup playbook.

Frequently asked questions

What is twclid?

twclid is the X Click ID — an identifier X generates and appends to your destination URL when someone clicks your ad. X's documentation says it should be parsed out of the query string parameter twclid when it is available after the user navigates to the destination website, then sent back with your conversion events so X can attribute the conversion to the click. The parameter kept its "tw" prefix from the Twitter era even after the rebrand to X.

Does twclid need to be hashed?

No. twclid is sent raw. X's Conversion API requires at least one identifier, and the accepted set treats them very differently: email address and phone number must be SHA-256 hashed (phone in E.164 format first), while IP address and user agent need no hashing but cannot stand alone — each must be paired with another identifier. twclid is the only identifier that needs neither hashing nor a partner, which is why X recommends always including the Click ID in the conversion request.

What is conversion_id in the X Conversion API?

Despite the name, conversion_id is not an identifier for the conversion in your own system — it is the deduplication key. X's documentation is specific: use the deduplication key in both the Pixel code snippet and the Conversion API request, as conversion_id, to deduplicate events between the Pixel and the Conversion API for the same event. If you populate it with your order number in one path and something else in the other, the two won't match and the same conversion gets counted twice.

What is the twclid attribution window?

X's public web-conversions API documentation does not state one, and it does not publish a retention period for twclid the way Google publishes 90 days for gclid. The 30-day click-through and 1-day view-through figures widely quoted in third-party guides come from connector documentation and blog posts, not from X's own API reference. Treat the attribution settings configured on your own ad account as the source of truth rather than a number copied from a guide.

Related terms

Put it to work

One value per event, both paths

A mismatched deduplication key doubles every conversion you report. The tracking-setup playbook walks the full capture-store-forward flow.