SDK Guide

Prev Next

Quick start

The SDK loop is identify → consent → measure. Replace JQT-XXXXXXXX with your tag id from the Tags section of the platform.  

jq("init", { tagId: "JQT-XXXXXXXX" });

// 1. Tell us who the visitor is — use the same id your ESP knows them by
jq("identify", "9283672739");

// 2. Grant consent from your CMP — nothing is sent before this
jq("consent", true);

// 3. Record conversions as they happen
jq("measure", "purchase", { value: 129.99, currency: "GBP", order_id: "ORD-10293" });
jq("measure", "registration_completed"); // zero-value conversions count too

Configuration

Call jq("init", options) once, as early as possible.

Option

Required

Default

Description

tagId

Yes

—

Your public install id from Jacquard. It can be rotated or revoked at any time.

userParam

No

—

A URL query param to auto-capture as the user id on landing — useful for email click-throughs.

consent

No

pending

Set to "granted" to opt in immediately on sites without a consent manager.

debug

No

false

Verbose console logging prefixed [jqrd-sdk]. Turn on while integrating.



jq("init", {
  tagId: "JQT-XXXXXXXX",
  userParam: "subscriber_id", // capture ?subscriber_id=... from email click-throughs
  debug: true,                // verbose console logging while integrating
});

API reference

jq("identify", userId)

Associates the current browser with a customer id. This must be the same id your ESP uses as the recipient — that match is what lets Jacquard attribute conversions back to sends. Identifiers that look like an email or phone number     are refused to keep PII off the wire; use your ESP’s opaque subscriber id. The id is stored first-party and reused on later visits, so you typically only call identify on login or when landing from an email.


jq("identify", "9283672739");

jq("consent", granted)

Wires up consent. Before it is granted, identify and measure calls are held in memory only — nothing is stored or sent. Granting consent flushes them in order. Revoking clears the stored identifier and any buffered events. Consent is remembered across visits, so you only need to call it when it changes.  

jq("consent", true);  // opt in — flushes any buffered events
jq("consent", false); // opt out — clears stored id and buffered events

jq("measure", eventName, props?)

Records a conversion. eventName can be any string — purchase, registration_completed, lead, etc. Pass     props.order_id for transactional events: it drives server-side de-duplication so an accidental double-fire counts once. Nothing is sent unless a user id is known, so call identify first.  

jq("measure", "purchase", { value: 129.99, currency: "GBP", order_id: "ORD-10293" });
jq("measure", "add_to_cart", { value: 24.0, currency: "GBP" });
jq("measure", "newsletter_signup"); // no value needed

Common integrations

Landing from an email

Most ESPs put a subscriber id in click URLs (e.g. …/sale?subscriber_id=9283672739). Point userParam at it and the SDK identifies the visitor automatically on arrival — no separate identify call needed.  

jq("init", { tagId: "JQT-XXXXXXXX", userParam: "subscriber_id" });

Single-page apps

Call init once at startup. Call identify when the user logs in (or on landing via userParam). The stored id persists across route changes and reloads, so you don’t need to re-identify on every view.  

// Call once at app startup
jq("init", { tagId: "JQT-XXXXXXXX" });

// Call when the user logs in
jq("identify", userId);

// Call on each conversion — the stored id persists across route changes
jq("measure", "purchase", { value: 59.99, currency: "USD", order_id: "ORD-555" });

Leave consent at its default (pending) and call jq("consent", true) from your CMP’s accepted callback. Everything stays buffered until then.  

// In your CMP's accepted callback:
jq("consent", true);

// In your CMP's withdrawal callback:
jq("consent", false);

Debugging

Set debug: true in init and watch the browser console — entries are prefixed [jqrd-sdk] and log what each command did and why.  

Common reasons a conversion doesn’t send:

  • No user id known — identify wasn’t called and no userParam matched.

  • Consent pending — the event is buffered; it flushes on jq("consent", true).

  • PII identifier — an email or phone number was passed to identify. Use your ESP’s subscriber id instead.

  • Invalid value — value was negative or non-numeric (0 is valid).