Skip to content
Browse documentation

The /lp endpoint (gclid joins, direct and organic clicks)

Request and response contract of POST /lp, which returns the click ID a landing page should keep.

Last updated 4 min read

On this page

POST https://trackcrown.com/lp is the call the landing-page SDK makes on page load. Call it yourself when you cannot use the script — for example from a single-page app or a server-rendered landing page. It answers with the click ID the page should keep and report conversions with.

Request#

ItemValue
MethodPOST (OPTIONS preflight answers 204). Other methods → 405.
CORSAccess-Control-Allow-Origin: *; no credentials needed.
BodyA JSON object, max 16 KiB. Send it as text/plain to avoid a CORS preflight (the SDK does).
FieldTypeDescription
click_idstringClick ID already on the page (32 hex).
gclidstringGoogle click ID from the landing-page URL (max 1,024 characters).
gbraid, wbraidstringGoogle iOS click IDs (used when no gclid click matched).
offerstring or numberOffer code or ID. Identifies the workspace and is the offer of a new direct click.
affstring or numberPartner code or ID for a new direct click.
organicbooleantrue = record an organic click if nothing joins (requires the organic partner setting).
urlstringThe landing-page URL. Its query string fills the new click's sub IDs and ad-platform IDs exactly like a tracking link.
referrerstringdocument.referrer.

Response#

JSON
{"click_id":"0192f3c1a2b4e1f0c9d84b2a7e6f5d3c","source":"gclid"}

The tracking domain answers in this order:

Request carriesAnswersource
click_idThe same ID, normalised to lower case (not looked up).param
gclid, no offer, on a shared brand domainThe newest click with that gclid in any workspace of the brand served by this domain (90 days).gclid
gclid (with offer, or on a workspace's own domain)The newest click with that gclid in the workspace — within the offer's attribution window when offer is given (restricted to that offer and offer-less clicks), else 90 days.gclid
gbraid or wbraidThe newest click with that ID in the workspace (needs offer or a workspace domain).gbraid / wbraid
nothing joins, organic: true, organic partner configured, no affA new click for the organic partner.organic
nothing joins, offer givenA new direct click for the offer (and aff). The gclid, if any, is stored on it.direct

A parallel-tracking click is found immediately, even while it is still waiting to be written to the reporting database (the recent-click cache is checked first).

Direct and organic clicks get the visitor's IP, geo, device, user agent, language and referrer, are checked for uniqueness (same key as tracking links: offer, partner, IP and user agent within 24 hours) and get fraud flags. They are reported with link type direct, status reason lp (or organic).

Errors#

All errors are JSON {"error":"…"}.

HTTPerrorCause
400invalid bodyThe body could not be read or is larger than 16 KiB.
400JSON object expectedThe body is not a JSON object.
400invalid click_idclick_id is not 32 hexadecimal characters.
400unknown offeroffer does not exist.
400offer requiredNothing joined and a new direct click would need an offer (also: a gclid on a shared domain that matched nothing).
400workspace not activeThe offer's workspace is suspended or pending.
400this tracking domain does not serve the offerThe domain belongs to another brand or workspace.
400gclid too longMore than 1,024 characters.
400offer not activeA direct click was needed but the offer is paused, pending or archived.
400unknown affiliate / affiliate not activeaff does not exist in the workspace, or is not active.
400affiliate not approved for this offeraff is not approved on a non-public offer.
405method not allowedNot POST or OPTIONS.
503click store unavailable / configuration not loadedTemporary; retry.

Examples#

Parallel tracking on a shared brand domain, where the landing page only knows the gclid:

Shell
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"}

Direct visit for a partner's direct link:

Shell
curl -s https://trackcrown.com/lp -H 'Content-Type: text/plain' \
  -d '{"offer":"SHOP01","aff":"partner7","url":"https://www.example.com/?sub1=summer","referrer":""}'
# {"click_id":"0192f3c5…","source":"direct"}

Browser code without the SDK:

JavaScript
fetch("https://trackcrown.com/lp", {
  method: "POST",
  headers: { "Content-Type": "text/plain" },
  body: JSON.stringify({ offer: "SHOP01", gclid: new URL(location.href).searchParams.get("gclid") || "",
                         url: location.href, referrer: document.referrer }),
}).then((r) => r.json()).then((r) => { if (r.click_id) localStorage.setItem("atk_cid", r.click_id); });

Google's auto-tagging adds gclid (or gbraid / wbraid on iOS) to the final URL. With a transparent tracking template, the tracker reads them from the url= value of the click, so the template never needs {gbraid} or {wbraid} tags — Google has no such ValueTrack parameters. The same values on the landing page then join the click through /lp.

Something unclear or missing in this article?Tell us