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:
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)
4) Recommended integration flow¶
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 paramsthradTag("set", "field_name", value)sets one global field
Recognized keys used later by payload builders¶
Routing:
send_totag_id
Common metadata:
event_idoreventIdtimestamppage_urlorpageUrlreferreruser_agentoruserAgentchannelsession_idorsessionIdclient_idorclientId
Attribution:
attribution_typeorattributionTypeimpression_idorimpressionIdclick_idorclickIdbid_idorbidId
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_idororderIdevent_tsoreventTsevent_nameoreventNameexpsigorsignaturevaluecurrency
Notes:
- Extra keys are allowed and passed through.
advertiser_idandadvertiserIdare stripped and ignored.- Setting
tag_idorsend_toviasetestablishes the default target for laterevent,conversion, andview_conversioncalls.
consent command¶
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_toortag_id(target selection)event_idoreventIdtimestamppage_urlreferreruser_agentchannel(default:web)session_idorsessionId(auto-generated if missing)attribution_typeorattributionTypeimpression_idorimpressionIdclick_idorclickIdbid_idorbidId
Auto-derived when missing¶
page_url,referrer,user_agentsession_id- attribution context:
click_id/bid_idfrom stored click tokenimpression_id/bid_idfrom stored impression linkattribution_typeinferred asclickorviewwhen 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(orclickId, or stored click token)exp(or stored click token)sigorsignature(or stored click token)order_idororderId
Optional params¶
send_toortag_idevent_tsoreventTs(default: current unix seconds)valuecurrencypage_urlorpageUrlreferreruser_agentoruserAgentevent_idoreventIdclient_idorclientIdattribution_typeorattributionTypeimpression_idorimpressionIdchannel(default:web)session_idorsessionId
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(orimpressionId, or stored impression link)order_idororderId
Optional params¶
send_toortag_idevent_tsoreventTs(default: current unix seconds)event_nameoreventNamevaluecurrencypage_urlorpageUrlreferreruser_agentoruserAgentevent_idoreventIdclient_idorclientIdattribution_typeorattributionType(default:view)bid_idorbidIdchannel(default:web)session_idorsessionId
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
setvalues. - Returns
undefinedif no value is found.
Auto-captured URL params¶
On load, tag.js captures click token params from query or hash query:
thrad_click_idthrad_expthrad_sigthrad_bid_id
These are stored first-party (localStorage + cookie fallback) and reused for conversion attribution.