Skip to content

Landing-page SDK

Keep the click ID on your landing page and join parallel-tracking clicks by gclid.

2 min read

Browse documentation

The landing-page SDK is a small script (ES5, no dependencies) served from your tracking domain. It keeps the click ID available on your landing page, joins Google Ads parallel-tracking clicks by gclid, records direct visits, and fires conversions from the browser.

Install#

Add the script to every page of your landing site, before the closing </body> tag:

HTML
<script async src="https://track.example.com/sdk.js" data-offer="OFFERCODE"></script>
AttributeDescription
data-offerOffer code. Needed to record direct visits (no click ID, no gclid) and for conversions without a click.
data-affPartner code for direct visits (also read from an aff query parameter).
data-paramName of the click-ID parameter in your landing-page URLs. Default click_id.

How the click ID is found#

When the page loads the SDK looks, in order, for:

  1. a click ID in the page URL (data-param, click_id, transaction_id or tid);
  2. a Google click ID (gclid, gbraid or wbraid) — the SDK asks the tracking domain for the click recorded by the tracking template (this is how parallel tracking is joined);
  3. a click ID stored earlier on this site (local storage and a first-party atk_cid cookie, kept for 30 days);
  4. otherwise, if data-offer is set, a direct click is recorded for the offer.

JavaScript API#

HTML
<script>
  window.ArcTrack = window.ArcTrack || [];
  // Calls are queued until the script has loaded:
  ArcTrack.push(["conversion", { event: "sale", amount: "49.90", txid: "ORDER-1001", currency: "USD" }]);
</script>
CallDescription
ArcTrack.clickId()The current click ID, or null.
ArcTrack.ready(fn)Calls fn(clickId) once the click ID is known.
ArcTrack.conversion({event, amount, txid, currency, …})Fires a conversion pixel (/px) for the current click. Extra keys are sent as parameters (for example adv1).
ArcTrack.decorate()Re-scans links on the page (see below).

Conversions fired by the SDK are pixel conversions, so the offer's conversion method must allow pixels.

Passing the click ID on#

The SDK rewrites links on the page so the click ID travels to your checkout or sign-up domain:

  • any link whose href contains {click_id} gets the macro replaced;
  • any link with a data-atk attribute gets click_id=<id> appended (or the parameter named in data-atk).
HTML
<a href="https://checkout.example.com/buy?ref={click_id}">Buy now</a>
<a href="https://app.example.com/signup" data-atk="aid">Sign up</a>

The /lp endpoint#

The SDK talks to POST https://track.example.com/lp with a JSON body {click_id?, gclid?, gbraid?, wbraid?, offer?, aff?, url, referrer} and receives {"click_id":"…"}. You can call it from your own code if you do not use the script. CORS is open and the request needs no credentials.

Privacy#

The SDK stores only the random click ID on your domain. Mention it in your website's cookie notice and ask for consent where your local law requires it.

Something unclear or missing on this page?Tell us

Ready to send your first click?

Create a workspace, add a tracking domain and copy your first link — the guides above walk you through every step.