Skip to content

Tag.js Settings Reference (Advertisers)

This page documents all browser-side settings and parameter keys supported by tag.js (window.thradTag).

API surface

Supported commands:

  • thradTag("set", paramsObject)
  • thradTag("set", fieldName, value)
  • thradTag("event", eventName, params?)
  • thradTag("conversion", params?)
  • thradTag("view_conversion", params?)
  • thradTag("consent", "default" | "update", consentParams)
  • thradTag("get", targetId, fieldName, callback)

Important: tag.js does not have a separate config command (that exists in ptag, not tag.js).

Initialization settings

1) Pre-init queue

You can queue calls before tag.js is loaded:

<script>
  window.thradTag =
    window.thradTag ||
    function () {
      (window.thradTag.q = window.thradTag.q || []).push(arguments);
    };
  window.thradTag.q = window.thradTag.q || [];
</script>

2) Endpoint base override (optional)

For testing/dev you can override API base:

<script>
  window.__thradEndpointBase = "http://localhost:8690";
</script>

Default base is https://events.thrad.ai.

3) Optional helper methods

After load, tag.js also exposes:

  • thradTag.linkImpression() (sync view-through impression link)
  • thradTag.readUrl() (URL parser helper)
  • thradTag.hello() (smoke-test helper)

Initialize once, set shared identifiers/defaults once, then emit events as needed:

<script>
  window.thradTag =
    window.thradTag ||
    function () {
      (window.thradTag.q = window.thradTag.q || []).push(arguments);
    };
  window.thradTag.q = window.thradTag.q || [];

  window.thradTag("set", {
    tag_id: "adv_001",
    channel: "web",
    campaign_id: "spring_2026",
  });

  window.thradTag("event", "page_view");
</script>
<script async src="https://cdn.thrad.ai/tag.min.js"></script>

set command

Forms

  • thradTag("set", { ... }) sets/merges global params
  • thradTag("set", "field_name", value) sets one global field

Recognized keys used later by payload builders

Routing:

  • send_to
  • tag_id

Common metadata:

  • event_id or eventId
  • timestamp
  • page_url or pageUrl
  • referrer
  • user_agent or userAgent
  • channel
  • session_id or sessionId
  • client_id or clientId

Attribution:

  • attribution_type or attributionType
  • impression_id or impressionId
  • click_id or clickId
  • bid_id or bidId

When tag_id or send_to is set here, later event/conversion/view_conversion calls can omit tag_id/send_to unless they need to override it.

Conversion/view fields:

  • order_id or orderId
  • event_ts or eventTs
  • event_name or eventName
  • exp
  • sig or signature
  • value
  • currency

Notes:

  • Extra keys are allowed and passed through.
  • advertiser_id and advertiserId are stripped and ignored.
  • Setting tag_id or send_to via set establishes the default target for later event, conversion, and view_conversion calls.

Use:

  • thradTag("consent", "default", params)
  • thradTag("consent", "update", params)

Supported standard fields:

  • ad_storage: "granted" or "denied"
  • ad_user_data: "granted" or "denied"
  • ad_personalization: "granted" or "denied"
  • analytics_storage: "granted" or "denied"
  • wait_for_update: number

Additional consent keys are also accepted.

event command settings

Use:

<script>
  window.thradTag("set", { tag_id: "adv_001" });
  window.thradTag("event", "page_view", {
    page_url: window.location.href,
  });
</script>

Recognized params

  • send_to or tag_id (target selection)
  • event_id or eventId
  • timestamp
  • page_url
  • referrer
  • user_agent
  • channel (default: web)
  • session_id or sessionId (auto-generated if missing)
  • attribution_type or attributionType
  • impression_id or impressionId
  • click_id or clickId
  • bid_id or bidId

Auto-derived when missing

  • page_url, referrer, user_agent
  • session_id
  • attribution context:
  • click_id/bid_id from stored click token
  • impression_id/bid_id from stored impression link
  • attribution_type inferred as click or view when possible

conversion command settings

Use:

<script>
  window.thradTag("conversion", {
    order_id: "order_123",
    value: 99.99,
    currency: "USD",
  });
</script>

Required (effective)

The payload is sent only when these exist:

  • click_id (or clickId, or stored click token)
  • exp (or stored click token)
  • sig or signature (or stored click token)
  • order_id or orderId

Optional params

  • send_to or tag_id
  • event_ts or eventTs (default: current unix seconds)
  • value
  • currency
  • page_url or pageUrl
  • referrer
  • user_agent or userAgent
  • event_id or eventId
  • client_id or clientId
  • attribution_type or attributionType
  • impression_id or impressionId
  • channel (default: web)
  • session_id or sessionId

If send_to/tag_id is omitted, the default target from thradTag("set", ...) is used.

view_conversion command settings

Use:

<script>
  window.thradTag("view_conversion", {
    order_id: "order_123",
    value: 99.99,
    currency: "USD",
  });
</script>

Required (effective)

The payload is sent only when these exist:

  • impression_id (or impressionId, or stored impression link)
  • order_id or orderId

Optional params

  • send_to or tag_id
  • event_ts or eventTs (default: current unix seconds)
  • event_name or eventName
  • value
  • currency
  • page_url or pageUrl
  • referrer
  • user_agent or userAgent
  • event_id or eventId
  • client_id or clientId
  • attribution_type or attributionType (default: view)
  • bid_id or bidId
  • channel (default: web)
  • session_id or sessionId

If send_to/tag_id is omitted, the default target from thradTag("set", ...) is used.

get command

Use:

<script>
  window.thradTag("get", "adv_001", "campaign_id", function (value) {
    console.log("campaign_id =", value);
  });
</script>

Behavior:

  • Reads target-specific config first, then global set values.
  • Returns undefined if no value is found.

Auto-captured URL params

On load, tag.js captures click token params from query or hash query:

  • thrad_click_id
  • thrad_exp
  • thrad_sig
  • thrad_bid_id

These are stored first-party (localStorage + cookie fallback) and reused for conversion attribution.