> For the complete documentation index, see [llms.txt](https://docs.chord.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chord.co/activate/event-streaming/destinations/advertising/x.md).

# X

**X** (formerly Twitter) Ads is X's advertising platform for promoted content, conversion campaigns, and audience targeting. This destination loads the X Universal Website Tag (UWT) JavaScript SDK in the browser and forwards conversion events based on a configurable event mapping. Page and identify events are not forwarded. There is no server-side component.

## Getting started

This is a browser destination. Chord loads the X Universal Website Tag for you, so you don't install any script.

You need your X Pixel ID, found in your X Ads account under **Tools > Conversion Tracking**. You also need an X event ID for each conversion you want to send. Create them in X, for example `tw-abc12-def34`.

## Settings

* **Destination Name** (required): a name to tell this destination apart.
* **Pixel ID** (required): your X Pixel ID from your X Ads account.
* **Event Mapping** (optional): maps Chord event names to X event IDs, for example `Product Added` to `tw-abc12-def34`. **Chord only sends events that have an entry here.** Chord skips every unmapped event and logs the skip in the browser console.
* **Product Identifier** (optional): which product field to use as the content ID (`product_id`, `sku` or `id`). Defaults to `product_id`. If the product has no value in the chosen field, Chord falls back to `product_id`, then `id`, then `sku`.
* **Consent Requirements** (optional): the consent categories a visitor must accept before Chord sends data to this destination. See [Consent](/activate/event-streaming/consent.md).

## Connect

Add **Twitter Ads** from the destination catalog, using the settings above. See [Connect a destination](/activate/event-streaming/connect-a-destination.md) for the full steps.

## Events

Page and identify events are **not** forwarded to X.

Only track events with an entry in **Event Mapping** are forwarded. Chord skips all other events. An `Order Completed` event with no products is also skipped.

## Track events

**X SDK call:** `twq("event", xEventId, eventPayload)`

### User parameters

| Chord source (priority order)                                | X field         | Notes                             |
| ------------------------------------------------------------ | --------------- | --------------------------------- |
| `properties.email` > `context.traits.email` > `traits.email` | `email_address` | Automatically hashed by the X SDK |
| `properties.phone` > `context.traits.phone` > `traits.phone` | `phone_number`  | Automatically hashed by the X SDK |

### Order parameters

| Chord source (priority order)                                                                               | X field         | Notes                                                                         |
| ----------------------------------------------------------------------------------------------------------- | --------------- | ----------------------------------------------------------------------------- |
| `properties.revenue` > `properties.total` > `properties.value`                                              | `value`         | Falls back to the sum of product prices when none is set                      |
| `properties.currency` > `properties.meta.i18n.currency`                                                     | `currency`      | Defaults to `"USD"`                                                           |
| `properties.cart_id` > `properties.cartId` > `properties.order_id` > `properties.orderId` > `properties.id` | `conversion_id` | Used for deduplication. A cart ID wins over an order ID when both are present |

### Product contents

Each product in `properties.products[]` is mapped to an X content item:

| Chord source (priority order)                                                            | X field            | Notes |
| ---------------------------------------------------------------------------------------- | ------------------ | ----- |
| Configured `identifier` field from `properties.products[]` > `product_id` > `id` > `sku` | `content_id`       |       |
| `properties.products[].name`                                                             | `content_name`     |       |
| `properties.products[].price`                                                            | `content_price`    |       |
| `properties.products[].quantity`                                                         | `num_items`        |       |
| `properties.products[].category`                                                         | `content_type`     |       |
| `properties.products[].variant_id`                                                       | `content_group_id` |       |

All undefined values are filtered out before sending.

## Custom properties

Any custom property mapping you configure is added to the event first. The fields in the tables above are added after it, so a field Chord computes replaces a mapped one with the same name.

## Initialization

Chord sets up the `twq` function queue, then loads `https://static.ads-twitter.com/uwt.js`. After the script loads, it calls `twq("config", pixelId)` to initialize the pixel.

Chord manages SDK loading state (`fresh` → `loading` → `loaded`/`failed`) to prevent duplicate script loads. If the script fails to load, subsequent events are silently dropped.

## CSP requirements

If your site uses a Content Security Policy, allow the following domains:

| Directive     | Domain                           |
| ------------- | -------------------------------- |
| `script-src`  | `https://static.ads-twitter.com` |
| `connect-src` | `https://static.ads-twitter.com` |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.chord.co/activate/event-streaming/destinations/advertising/x.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
