tracker.getClickIdentifiers()
Returns whichever Google Ads click identifiers the tracker has captured — from the URL on the current page load, from the _tb_* cookies on prior visits, or both. Use this to forward click IDs to your server when the user submits an order, so your server-side trackConversion call can include them.
Signature
Section titled “Signature”tracker.getClickIdentifiers(): ClickIdentifiers;ClickIdentifiers
Section titled “ClickIdentifiers”type ClickIdentifiers = { gclid?: string; gbraid?: string; wbraid?: string;};Each field is present only if the corresponding identifier was captured. The return value is a shallow copy — mutating it does not affect the tracker’s internal state.
Behavior
Section titled “Behavior”- Synchronous; does not touch the network.
- Reflects the tracker’s in-memory state, which is hydrated from URL params and cookies at init time and updated by
updateConsentif pre-grant values were buffered. - If
clickIdentifierStorage === 'none', this always returns{}.
Example: forward to your checkout API
Section titled “Example: forward to your checkout API”import { tracker } from '@/lib/tracker.client';
async function submitCheckout(orderData: OrderInput) { const clickIds = tracker.getClickIdentifiers();
const res = await fetch('/api/checkout', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ ...orderData, clickIds }), }); return res.json();}On the server side, store the click IDs with the order:
const order = await db.orders.create({ ...orderData, gclid: clickIds.gclid, gbraid: clickIds.gbraid, wbraid: clickIds.wbraid,});Then the server-side trackConversion can attach them:
await serverTracker.trackConversion({ label: 'purchase', transactionId: order.id, gclid: order.gclid, gbraid: order.gbraid, wbraid: order.wbraid, // ...});See also
Section titled “See also”- Click identifiers (gclid / gbraid / wbraid)
- Cookies — the underlying
_tb_*cookie shape.