Tag
12 min
the tag destination lets you run custom javascript or html snippets in the browser whenever a chord cdp event fires use it to send events to third party tools that don't have a built in chord destination, fire custom pixels, or trigger any browser side logic tied to your event stream there is no server side component getting started this is a device mode destination no external credentials are required — you provide the code to execute directly in the destination configuration connecting to the tag cdp destination log into the chord data platform navigate to the cdp click the "add" button next to destinations select tag from the destination catalog enter a destination name paste your javascript or html snippet into the code field click "create" to connect how it works every time a chord event fires (e g window\ chord track("order completed", { }) ), the tag destination executes your code once with the full event object available your snippet runs synchronously in the browser — no polling, no persistent listeners required two code modes are supported javascript mode write plain javascript the event is available as a local const event variable — no imports or setup needed source track call window\ chord track("order completed", { order id "r 10042", revenue 89 95, total 96 94, currency "usd", order date "2026 05 11t14 23 00z", email "jane\@example com", shipping 4 99, tax 2 0, subtotal 79 97, products \[ { product id "prod 1", sku "shirt blu m", name "blue t shirt", price 29 99, quantity 2, revenue 59 98 }, { product id "prod 2", sku "hat blk os", name "black cap", price 19 99, quantity 1, revenue 19 99 } ] }); tag destination code console log(event event, event properties); console output order completed {order id 'r 10042', revenue 89 95, total 96 94, currency 'usd', order date '2026 05 11t14 23 00z', products array(2), …} html mode embed \<script> tags or pixel \<img> tags use the {{ event }} macro inside \<script> blocks; it is replaced at runtime with the full json serialized event object avoid using it in html attributes — the substituted value is raw json (with quotes and braces) and will break attribute syntax source track call (same as above) tag destination code after macro substitution , the injected script looks like the event object field type present on description type string all events event type "track" , "identify" , or "page" event string track only event name, e g "order completed" userid string all events identified user id (if available) anonymousid string all events anonymous browser id timestamp string all events iso 8601 timestamp messageid string all events unique id for this event properties object track , page event specific or page properties traits object identify user traits passed to identify() context object all events contextual info ip, user agent, page url, campaign, etc use event type to distinguish between call types; use event event to match specific track event names filtering by event name your code receives every event use a conditional to scope your logic to specific events if (event event === "order completed") { // runs only on order completed } example hello world — order completed this snippet logs order details to the browser console and sends a beacon to a custom endpoint whenever an order completed event fires source track call window\ chord track("order completed", { order id "r 10042", revenue 89 95, total 96 94, currency "usd", order date "2026 05 11t14 23 00z", email "jane\@example com", shipping 4 99, tax 2 0, subtotal 79 97, products \[ { product id "prod 1", sku "shirt blu m", name "blue t shirt", price 29 99, quantity 2, revenue 59 98 }, { product id "prod 2", sku "hat blk os", name "black cap", price 19 99, quantity 1, revenue 19 99 } ] }); tag destination code if (event event === "order completed") { var props = event properties; console log( "\[my tag] order completed — order id ", props order id, "revenue ", props revenue, "currency ", props currency ); navigator sendbeacon( "https //my analytics example com/collect", json stringify({ event event event, order id props order id, revenue props revenue, currency props currency, products props products }) ); } console output \[my tag] order completed — order id r 10042 revenue 89 95 currency usd beacon payload (json body sent to your endpoint) { "event" "order completed", "order id" "r 10042", "revenue" 89 95, "currency" "usd", "products" \[ { "product id" "prod 1", "sku" "shirt blu m", "name" "blue t shirt", "price" 29 99, "quantity" 2, "revenue" 59 98 }, { "product id" "prod 2", "sku" "hat blk os", "name" "black cap", "price" 19 99, "quantity" 1, "revenue" 19 99 } ] } order completed properties reference property type required description order id string yes order identifier revenue number yes revenue from the order total number yes total order value currency string yes iso 4217 currency code (e g "usd" ) order date string yes order date (iso 8601) products array yes line items — see tracking plan for product schema email string no customer email first name string no customer first name last name string no customer last name coupon string no coupon code applied discount number no discount amount shipping number no shipping cost tax number no tax amount subtotal number no pre tax, pre shipping subtotal for the full tracking plan including all events and property schemas, refer to the chord tracking plan documentation limitations device mode only — tag destination code runs in the browser it has no access to server side context and cannot be used for server to server integrations no persistent state — your snippet is executed fresh on each event use window to share state across calls if needed event filtering — the destination connection supports events and hosts filters in the connection settings to restrict which events or domains trigger your code you can also filter inside your snippet with event type or event event for finer grained control updated 11 may 2026