Skip to main content
GET /v1/script returns everything you need to install the Knock2 tracking script on your site. The script is served directly from Knock2’s own API (not a separate CDN) — the response includes the script URL and a pre-built <script> tag with your tenant slug already baked into the path, so you can paste it directly into your site’s <head> without any manual configuration.
You can call this with the per-tenant API key returned by POST /v1/tenants, or with your parent API key plus X-Knock-Tenant (or ?product_slug=) to fetch a direct child’s script without switching keys — see Reading a Child Tenant’s Data.

Endpoint

Request Parameters

string
Read a direct child tenant’s script instead of your own (multi-tenant partners only). The X-Knock-Tenant header takes precedence if both are supplied.
string
Same as product_slug above, as a header instead of a query param. Naming a slug that isn’t a direct child of your key returns 404, never 403.

Example Requests

Response

A successful request returns 200 OK with a ScriptResponse body.
string
The full tracking script URL for this tenant, served from Knock2’s API. Use this if you are loading the script programmatically or through a tag manager.
string
A ready-to-paste <script> tag with your tenant’s script URL already filled in. Copy this value and add it to the <head> of every page you want to track. No further configuration is required.

Installing the Script

Take the embed_html value from the response and add it to the <head> section of your site:
Place the tag on every page you want Knock2 to track. After installation, verify the script is firing correctly with GET /v1/script/status.

Error Responses