Landing-page SDK reference
The sdk.js script and the /lp endpoint — install attributes, how the click ID is found and stored, the JavaScript API (window.ArcTrack), link decoration and every /lp answer.
Last updated 6 min read
On this page
The landing-page SDK is a small script (ES5, no dependencies) served from your tracking domain at /sdk.js. It keeps
the click ID available on your landing site, joins Google Ads parallel-tracking clicks by gclid, records direct and
organic visits, decorates links and fires conversions from the browser.
Install#
Add the script to every page of your landing site — in the <head> or before </body>:
<script async src="https://trackcrown.com/sdk.js" data-offer="OFFERCODE"></script>Load the script once per page; a second copy does nothing.
How the click ID is found#
When the page loads, the SDK checks, in this order:
- A click ID in the page URL — the
data-paramparameter, thenclick_id,transaction_id,tid(32 hex characters). It is used as is. - A Google click ID —
gclid,gbraidorwbraidin the URL. The SDK asks the tracking domain (POST /lp) for the click recorded by the tracking template's background request — this is how parallel tracking is joined. If nothing is found, it falls back to a stored click ID. - A stored click ID from an earlier visit (local storage, else the
atk_cidcookie). - Organic — with
data-organicand an organic partner configured, a new organic click is recorded:sub1= the source platform from the referrer (google,bing,facebook,x,referralordirect),sub2= the referring host,sub3= the landing path. - Direct — with
data-offer, a new direct click is recorded for the offer (anddata-aff).
Otherwise there is no click ID (ArcTrack.clickId() returns null). The /lp request times out after 5 seconds.
Storage#
A partner's click always wins: a visitor who later arrives through a partner link replaces the stored organic click.
When the first click differs from the current one, conversions carry it as first_click_id; your workspace's
attribution model (Settings → Conversion rules: last touch by default, or first touch) decides which is credited.
JavaScript API#
The SDK exposes one global object, window.ArcTrack. ArcTrack is a fixed technical name of the tracking
engine — the same on every installation, whatever your brand — so your code never changes when the brand does. Calls made before the script has loaded are queued:
<script>
window.ArcTrack = window.ArcTrack || [];
ArcTrack.push(["conversion", { event: "sale", amount: "49.90", txid: "ORDER-1001", currency: "USD" }]);
ArcTrack.push(function (clickId) { console.log("click", clickId); });
</script>
<script async src="https://trackcrown.com/sdk.js" data-offer="OFFERCODE"></script>conversion()#
ArcTrack.conversion(params) requests https://trackcrown.com/px? as an image. It sends:
click_id(when known) andfirst_click_id(when it differs);offer=data-offeronly when no click ID is known (direct and organic conversions), unless you passoffer/offer_idyourself. With a click ID no offer is sent — also not anoffer/offer_idyou pass — because the click names its offer, and a different offer would be refused withoffer_id does not match the click;aff=data-aff, unless you passaff/aff_idyourself;- every other key of
paramsas a query parameter —event,amount,txid,currency,adv1…adv5,email,coupon_codeand so on (objects, functions and the keysclick_id,token,jsare skipped); - a random
rcache buster.
These are pixel conversions (method js): the offer's conversion method must allow pixels (any or pixel).
Parameters: Conversion pixels.
Passing the click ID on#
The SDK rewrites links when the click ID is known, and again on every link click (so links added later are covered):
- a link whose
hrefcontains{click_id}(or%7Bclick_id%7D) gets the macro replaced; - a link with a
data-atkattribute getsclick_id=<id>set — or the parameter named indata-atk(an existing value is replaced, a#fragmentkept).
javascript:, mailto: and tel: links are never touched.
<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://trackcrown.com/lp. You can call it from your own code. CORS is open, no
credentials are needed, and the body may be sent as text/plain (no CORS preflight).
Request body (JSON):
Answer: {"click_id": "…", "source": "…"}, decided in this order:
The direct click maps the page URL's query parameters onto the click like a tracking link (sub IDs, ValueTrack
values, gclid). A click found by gclid is returned immediately, even while it is still being written to the
reporting database.
Errors are JSON {"error": "…"}:
The SDK reports every failed /lp call on the browser console (console.warn, prefixed with the SDK object name ArcTrack:) with the HTTP
status and error — for offer required with the hint to add data-offer="OFFERCODE" to the script tag — and
ArcTrack.error() returns the same text. A timeout or network error is reported too. The page itself is never
affected.
Example — parallel tracking on a shared brand domain, where the page only knows the gclid:
curl -s https://trackcrown.com/lp -H 'Content-Type: text/plain' \
-d '{"gclid":"EAIaIQobChMI","url":"https://www.example.com/?gclid=EAIaIQobChMI"}'
# {"click_id":"0192f3c1a2b4e1f0c9d84b2a7e6f5d3c","source":"gclid"}Clicks a Google Ads tracking template sends through the tracker store the gclid, gbraid and wbraid that
auto-tagging adds to the landing page (the url= value), so templates never need {gbraid} or {wbraid} tags.
Privacy#
The SDK stores only the random click IDs (atk_cid, atk_fcid) on your domain. Mention them in your cookie notice
and ask for consent where your law requires it.
See also: Parallel tracking · Final URL suffix + SDK.