> 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/microsoft/microsoft-conversions-api.md).

# Microsoft Conversions API

The **Microsoft Conversions API** (CAPI) is a server-side integration that sends event data directly from Chord to Microsoft Advertising's servers. Microsoft Advertising was formerly Bing Ads. Unlike the [UET tag](/activate/event-streaming/destinations/advertising/microsoft/microsoft-uet-tag.md), which runs in the browser, the Conversions API sends events from the server, so ad blockers and browser tracking restrictions don't affect them.

Microsoft recommends using the Conversions API alongside the UET tag for maximum data coverage. When both are configured, Microsoft deduplicates purchases using the `eventId` field, which Chord sets to the order ID on both sides. See [Microsoft](/activate/event-streaming/destinations/advertising/microsoft.md#how-they-deduplicate).

Use this destination if:

* You run paid media through Microsoft Advertising
* You want improved signal reliability independent of browser limitations or ad blockers
* You want to support Microsoft's automated bidding and optimization with high-quality server-side event data

## Getting started

You need:

* Your UET Tag ID, found in your Microsoft Advertising dashboard under Conversion tracking > UET tags. We recommend creating a dedicated tag for the Conversions API.
* An access token. Select "Use Conversions API" on your UET tag in the Microsoft Advertising dashboard to generate one. Contact your Microsoft account manager if this option isn't available.

## Settings

* **Destination Name** (required): a name to tell this destination apart.
* **Tag ID** (required): your Microsoft Advertising UET Tag ID.
* **Access Token** (required): the access token for the Microsoft Advertising Conversions API.
* **Website URL** (optional): your storefront URL, for example `https://www.example.com`. Microsoft rejects events with an empty source URL. Browser events carry the page URL, but server-side events don't, so Chord uses this value instead. Required for any back-end connection.
* **Event Mapping** (optional): overrides the event action Microsoft receives. By default Chord sends the event's own name, for example `Order Completed`, which matches the UET tag so both share one conversion goal. Map a **Chord Event Name** to a different **Microsoft Event Action**, for example `order_completed`, to match a goal that expects it. Matching in Microsoft Advertising is case-sensitive.
* **Ad Consent Category** (optional): the consent category from your consent tool that controls advertising consent. Chord reads each event's choice for this category and sends Microsoft an `adStorageConsent` value of granted (`G`) or denied (`D`). If an event has no choice for the category, Chord leaves the value out and Microsoft treats the event as granted. Defaults to **None**, which sends no consent signal.
* **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 **Microsoft CAPI** from the destination catalog, using the settings above. See [Connect a destination](/activate/event-streaming/connect-a-destination.md) for the full steps.

## Event architecture

Microsoft CAPI requires a `pageLoad` event to establish page context. Chord handles this automatically:

* **Page events** send a single `pageLoad` event
* **Track events** send a `pageLoad` + `custom` event pair, linked by a shared page load ID

This means Microsoft receives the page context needed for accurate attribution without any additional configuration.

## Event mapping

By default the event action (`eventName`) sent to Microsoft is the Chord event's own name, for example `Order Completed`. This matches the UET tag, which sends the raw event name, so the two versions can share a single conversion goal. Recognized commerce events also get a `pageType`:

| Chord event                                                           | Microsoft event | Notes |
| --------------------------------------------------------------------- | --------------- | ----- |
| [Product Viewed](/collect-data/tracking-plan/product-viewed.md)       | `product`       |       |
| [Products Searched](/collect-data/tracking-plan/products-searched.md) | `searchresults` |       |
| [Product Added](/collect-data/tracking-plan/product-added.md)         | `cart`          |       |
| [Checkout Started](/collect-data/tracking-plan/checkout-started.md)   | `cart`          |       |
| [Order Completed](/collect-data/tracking-plan/order-completed.md)     | `purchase`      |       |
| Order Placed                                                          | `purchase`      |       |
| *(other track events)*                                                | *(none)*        |       |

Chord sends page events and track events that have an event name. Identify and screen events are ignored.

### Overriding the event action

The **Event Mapping** setting overrides the event action for specific events. Unmapped events keep the event name as the default, so this is purely additive.

Use it when a conversion goal expects a different action string, for example a goal keyed on `order_completed`. In Chord you add one row per event, with a **Chord Event Name** and a **Microsoft Event Action**. For example:

* `Order Completed` → `order_completed`
* `Product Added` → `product_added`

Goal matching in Microsoft Advertising is **case-sensitive**, so the value must match the goal's Event Action rule exactly.

## Common event fields

These fields are included on every event sent to Microsoft.

| Chord source (priority order)                                                                                                                                 | Microsoft field  | Notes                                                                                                                                                                           |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| *(derived)*                                                                                                                                                   | `eventType`      | `pageLoad` or `custom`                                                                                                                                                          |
| For the custom event of Order Completed and Order Placed: `properties.order_id` > `properties.orderId` > `properties.id`. Otherwise `messageId` with a suffix | `eventId`        | The suffix is `-pl` for a page load and `-ce` for a custom event. A purchase with no order ID uses `messageId` with the `-ce` suffix. Used for deduplication with the UET tag   |
| `timestamp`                                                                                                                                                   | `eventTime`      | Converted to Unix seconds                                                                                                                                                       |
| `page.url` > `context.page.url` > `properties.url` > configured **Website URL**                                                                               | `eventSourceUrl` | Microsoft rejects events with an empty `eventSourceUrl`. Server-side (back-end) events carry no page URL, so the destination's **Website URL** setting is used as the fallback. |
| `page.referrer` > `context.page.referrer`                                                                                                                     | `referrerUrl`    |                                                                                                                                                                                 |
| `page.title` > `context.page.title` > `properties.title`                                                                                                      | `pageTitle`      |                                                                                                                                                                                 |

## User data

PII fields are SHA256-hashed using Microsoft-specific normalization rules before sending.

| Chord source (priority order)                                                                                           | Microsoft field   | Notes                                                                                             |
| ----------------------------------------------------------------------------------------------------------------------- | ----------------- | ------------------------------------------------------------------------------------------------- |
| `properties.email` > `context.traits.email`                                                                             | `em` (email)      | Microsoft-specific hashing: dots removed from user portion, +aliases stripped, lowercased, SHA256 |
| `properties.phone` > `context.traits.phone`                                                                             | `ph` (phone)      | Validated, normalized to E.164 format, SHA256-hashed. Invalid phones are silently dropped         |
| `userId`                                                                                                                | `externalId`      | SHA256-hashed (lowercased)                                                                        |
| `anonymousId`                                                                                                           | `anonymousId`     | **Not hashed** — Microsoft uses as guest UUID                                                     |
| `context.userAgent`                                                                                                     | `clientUserAgent` | Not hashed                                                                                        |
| `context.ip`                                                                                                            | `clientIpAddress` | Not hashed                                                                                        |
| URL parameter `msclkid` > `context.clientIds.msclkid` > `properties.msclkid` > `integrations["Microsoft CAPI"].msclkid` | `msclkid`         | Microsoft click ID for attribution                                                                |

## Phone validation

Phone numbers are validated before hashing. The following are silently rejected:

* Common junk values: `n/a`, `na`, `undefined`, `null`, `none`, `unknown`, `test`
* Numbers with fewer than 7 digits
* All-repeated-digit numbers (e.g., `1111111`)

## Custom data (track events)

The `custom` event in each pair includes conversion properties:

| Chord source (priority order)                                                       | Microsoft field | Notes                                                     |
| ----------------------------------------------------------------------------------- | --------------- | --------------------------------------------------------- |
| `properties.value` > `properties.revenue` > `properties.total` > `properties.price` | `value`         | First numeric value found. Also sent as `ecommTotalValue` |
| `properties.currency`                                                               | `currency`      | Omitted if not present                                    |
| `properties.orderId` > `properties.order_id` > `properties.transactionId`           | `transactionId` |                                                           |
| `properties.query` > `properties.search_term`                                       | `searchTerm`    |                                                           |
| `properties.category`                                                               | `eventCategory` | Also sent as `ecommCategory`                              |
| `properties.label`                                                                  | `eventLabel`    |                                                           |
| *(from event mapping table)*                                                        | `pageType`      | E.g., `product`, `cart`, `purchase`                       |
| See [Item attributes](#item-attributes)                                             | `items`         | Chord also sends the list of item IDs as `itemIds`        |

## Item attributes

For events about one product, such as Product Viewed and Product Added, item data comes from the top-level properties. Chord uses the first item of `properties.products` for any field the top level lacks:

| Chord source (priority order)                                | Microsoft field | Notes |
| ------------------------------------------------------------ | --------------- | ----- |
| `properties.sku` > `properties.product_id` > `properties.id` | `id`            |       |
| `properties.quantity`                                        | `quantity`      |       |
| `properties.price`                                           | `price`         |       |
| `properties.name`                                            | `name`          |       |

For Checkout Started and Order Completed, items come from the `properties.products` array:

| Chord source (priority order)                                | Microsoft field | Notes |
| ------------------------------------------------------------ | --------------- | ----- |
| `products[].sku` > `products[].product_id` > `products[].id` | `id`            |       |
| `products[].quantity`                                        | `quantity`      |       |
| `products[].price`                                           | `price`         |       |
| `products[].name`                                            | `name`          |       |

## Required fields

For purchase events (Order Completed / Order Placed) to be accepted by Microsoft, the following fields must be present:

* Event name and event time (Chord fills these in)
* A non-empty `eventSourceUrl`. Browser events supply this automatically; **back-end (server-side) connections must set the destination's Website URL setting**, which is used as the fallback. Without it, Microsoft rejects the event with a `400 ValidationError` (`'eventSourceUrl' must not be empty`).
* `properties.currency`
* `properties.value`, `properties.revenue`, or `properties.total` (at least one)
* `properties.order_id` or `properties.orderId`
* At least one user identifier: `properties.email`, `properties.phone`, or `msclkid` (from URL parameter)

## Testing and validation

After connecting the destination:

1. Use **Microsoft Advertising event diagnostics** (in the UET tags section of your dashboard) to confirm events are being received
2. Verify match rates — higher match rates indicate user identifiers (email, phone, msclkid) are being sent correctly
3. Confirm revenue values and order counts align with your expectations

If discrepancies appear:

* Confirm `msclkid` is being captured in your page URLs (Microsoft appends this to ad click-through URLs)
* Ensure required fields listed above are populated in your events
* Check that your access token has not expired — regenerate in the Microsoft Advertising dashboard if needed

## Property mappings

Use custom property mappings if the default field resolution does not match your data model:

| Destination Path                  | Description                                             |
| --------------------------------- | ------------------------------------------------------- |
| `properties.email`                | Email for enhanced conversions                          |
| `properties.phone`                | Phone for enhanced conversions (E.164 format preferred) |
| `properties.value`                | Primary conversion value                                |
| `properties.revenue`              | Fallback conversion value (subtotal)                    |
| `properties.currency`             | Currency code (e.g., `USD`)                             |
| `properties.order_id`             | Transaction ID for deduplication                        |
| `properties.products.[].sku`      | Product item IDs                                        |
| `properties.products.[].price`    | Per-item price                                          |
| `properties.products.[].quantity` | Per-item quantity                                       |
| `properties.products.[].name`     | Product display name                                    |


---

# 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/microsoft/microsoft-conversions-api.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.
