ads

PUT /v1/ads/site-tags/{tag_id}/first-party

Deploy first-party tracking with the customer's own Cloudflare API token.

All ads endpoints

All developer docs →

Zinn®, our Viking, hammering at his anvil beside an API endpoint sending events to several listeners.

Authentication

Send an API key as a bearer token. The key must carry the ads.manage permission; a key without it is refused with 403, not 404.

This endpoint takes no organisation id. Your key already identifies the organisation it belongs to, and the response is scoped to it.

Try it

Replace anything in angle brackets with your own values, and the key placeholder with a key from your dashboard.

curl -X PUT https://api.zinndigital.com/v1/ads/site-tags/{tag_id}/first-party \
  -H "Authorization: Bearer zdk_live_…" \
  -H "Content-Type: application/json" \
  -d '{ "token": <string> }'

Signed in? The API console in your dashboard fills in your real organisation id and your own key, and runs the request against the live API so you can see the actual response. Open this endpoint in the API console

Details

Gated on ads.manage; audit-logged (ads.first_party_connected, zone and route only). The token (Zone Read, Workers Scripts Edit, Workers Routes Edit) is checked by using it: one Worker zinn-ads-<id> is uploaded to the account of the site's zone and routed on <site_host>/ztag/* only. It serves the site's universal script and passes Google's tag gateway through, so gtag.js loads same-origin. Google decides where hits go: outside Europe they use <site_host>/ztag/ too; for visitors in Europe Google's library sends them to its regional endpoint, and it always sends a load-health probe and a session beacon straight to Google. Consent Mode v2 defaults are still set before any Google tag loads; before consent Google may send cookieless pings, and nothing is stored. No HTML, DNS or zone setting is changed. The token is kept only in Vault; sending a new one replaces it and destroys the old one. Refusals: refusal.adsconnect.firstParty.* (badToken, tokenRejected, permissionMissing, zoneNotFound 422; rateLimited, unavailable, vaultUnavailable 503).

Parameters

NameTypeRequiredWhat it is
tag_id (path)stringYes—

Request body

NameTypeRequiredWhat it is
tokenstringYes—

Response

NameTypeRequiredWhat it is
statusstring<off, ok, needs_token, failed>Yes—
pathstringYesThe path on the site host: /ztag.
providerstringNo—
zone_namestringNo—
route_patternstringYes—
script_namestringNo—
last_errorstringNoAn error code: tokenRejected, permissionMissing, zoneNotFound, rateLimited, unavailable, unexpected or routeMissing; empty when ok.
token_hintstringNoThe token's last four characters
checked_atstringNo—
snippetstringYes—

Errors this endpoint can return

401 · 403 · 404 · 422 · 503