# Bing Ads Destination

## Destination Info

* Accepts [Page](/docs/segment/connections/spec/page), [Track](/docs/segment/connections/spec/track) calls.
* Refer to it as **Bing Ads** in the [Integrations object.](/docs/segment/guides/filtering-data/#filtering-with-the-integrations-object)

### Components

* [Browser](https://github.com/segment-integrations/analytics.js-integration-bing-ads)

## Connection Modes

[Learn more about connection modes.](/docs/segment/connections/destinations/#connection-modes)

### Device-Mode

* web: yes
* mobile: no
* server: no

### Cloud-Mode

* web: no
* mobile: no
* server: no

[Bing Ads](https://bingads.microsoft.com) enables Marketers to track and monitor campaigns, clicks, CTRs, spend and budget. Bing Ads lets you place cross-device product ads in front of Bing, Yahoo, and MSN customers and support imported pay-per-click ad campaigns from third-party platforms like Google AdWords. With Bing Ads you can also retarget ads to customers after they complete an action like leaving a shopping cart or viewing a product without purchasing. To learn more, see [Bing Ads](https://advertise.bingads.microsoft.com/en-us/resources/training/what-is-bing-ads). You can also browse the code [on GitHub](https://github.com/segment-integrations/analytics.js-integration-bing-ads).

## Getting started

Before you can track conversions or target audiences, create a UET tag in Bing Ads and then add it to the destination settings. Follow the steps within [the Bing Ads documentation to create a UET tag](https://advertise.bingads.microsoft.com/en-us/resources/training/universal-event-tracking).

After you have created the Tag ID, follow these steps:

1. From the Segment web app, click **Catalog**.
2. Search for "Bing Ads" in the Catalog, select it, and choose which of your sources to connect to the destination. Note that the source must be sending events using Segment's JavaScript library Analytics.js.
3. In the destination settings, enter your Tag ID.

Your changes will appear in the Segment CDN in about 45 minutes, and then Analytics.js starts asynchronously loading Bing Ads snippets on your page and sending data.

***Note**: You'll only be able to include one Tag ID per source so make sure to associate the conversion goals to the correct Tag ID that is included in your settings.*

## Page

If you're not familiar with the Segment Spec, take a look to understand what the [Page method](/docs/segment/connections/spec/page/) does. An example call looks like:

```javascript
// name and properties are optional
analytics.page();
```

Page events will be sent to Bing Ads as a `Page Load` event where name and properties are optional.

## Track

If you're not familiar with the Segment Spec, take a look to understand what the [Track method](/docs/segment/connections/spec/track/) does.

For Segment to map your Track events to a Conversion Goal, first create the goal in your Bing Ads account:

1. From your Bing Ads account, click the **Campaigns** tab then click **Conversion Tracking**.
2. Under **Conversion Tracking**, click **Conversion Goals**.
3. On the conversion goals page, click **Create conversion goal**.
4. Enter a name for your goal in the **Goal name** box. When naming your goal, use a descriptive name that makes sense to you. (For example, "Checkout page")
5. Choose the `Event` type of conversion and click **Next**.
6. Fill in the appropriate values. Make sure to add the Segment event name as the **label** field and associate the goal to the correct Tag (**UET Tag**) that is set up in your Segment source.

## Setting up Custom Events:

### Step 1: Add the UET Tag Tracking Code to Your Website

1. Copy the UET tag from Microsoft Advertising.
2. Paste the tag into the head or body section of your website's code.

### Step 2: Create a Conversion Goal or Remarketing List

Creating a conversion goal for a custom event:

1. From the top menu, select **Tools > Conversion goals**.
2. Select the type of conversion you want to track.
3. Enter a descriptive name for your goal.
4. Fill in the appropriate values for your selected goal type. You must set Event Action to `track` when creating a conversion goal for a custom event in your Bing Ads account, as Event Type = `track` is required for your UET Tag to successfully validate the event.
5. Fine-tune your conversion goal with advanced settings.
6. Associate the UET tag with the conversion goal.

Creating a remarketing list for a custom event:

1. In Microsoft Advertising, click **Shared Library > Audiences.**
2. Click **Create audience > Remarketing list**.
3. For Whom to add to your audience, select **Custom events**.
4. Choose the parameters to report when logging custom events.
5. Set the membership duration.
6. Associate the UET tag with the remarketing list.

### Step 3: Modify the UET Tag Tracking Code in Your Website

1. Add the code for the custom event to the UET tag tracking code.
2. Follow the instructions provided to set up the event tag on your website.

For Segment to map your Track events to a Conversion Goal, create the goal in your Bing Ads account:

For information about tracking custom events, see Microsoft's article [How to track custom events with UET](https://help.ads.microsoft.com/#apex/ads/en/56684/2-500)

Only the event name property is required - other properties are optional. An example Track call is as follows:

```javascript
// Segment event
analytics.track('Order Completed', {
    category: 'tools'
    revenue: 25,
    ... // additional properties
});
```

| Property | Description                                   |
| -------- | --------------------------------------------- |
| Label    | Event Name (`'Order Completed'` in this case) |
| Value    | `revenue` property                            |
| Category | `category` property                           |
| Action   | Always set to `track`                         |

## Consent mode

Starting May 5, 2025, Microsoft is enforcing the use of consent mode for clients with end users in the European Economic Area (EEA), the United Kingdom, and Switzerland. To learn more about setting consent mode, refer to the [Microsoft docs](https://help.ads.microsoft.com/?FromAdsEmail=1#apex/ads/en/60341/1). Microsoft is currently only enforcing the [`ad_storage` value](https://help.ads.microsoft.com/?FromAdsEmail=1#apex/ads/en/60341/1/#exp46).

To send consent signals using the Microsoft Bing Ads destination:

1. Navigate to **Connections > Destinations** and select the Microsoft Bing Ads destination.
2. Select the **Settings** tab for the destination.
3. Turn on the **Enable Consent** setting. If it is turned off, the Microsoft Bing Ads destination won't send the consent signal.
4. Select **ALLOWED** or **DENIED** as the **Default Ads Storage Consent State**. This will be the default consent signal state when the page loads. You can toggle the consent state by passing consent signals using the Track or Page event.
5. If you're using Segment [Consent Management](/docs/segment/privacy/consent-management/), specify the consent category to look up the `ad_storage` consent state using the **Ad Storage Consent Category** setting.
6. If you're not a Segment consent management user, specify the properties field through which you want to toggle the consent setting with the `Ad Storage Consent Property Mapping` setting. For example, if you wish to toggle `ad_storage` consent state based `properties.ad_storage`, set the value to `ad_storage` and make sure the `properties.ad_storage` in your track or page event is set to `granted` or `denied`.

## Troubleshooting

### Script unverified or undetected by third-party tool

Many times this is a limitation on the tool's detection process, where the detector is looking for a specific HTML element on your page. Our client side analytics.js library asynchronously loads the tool's library or pixel onto the page. As such, the detection fails.

In order to confirm that the tool's library or pixel is actually loaded onto the page, you can open up the [JavaScript console](/docs/segment/connections/sources/catalog/libraries/website/javascript#how-do-i-open-the-javascript-console-in-your-debugger) and go to the network tab when the page is loading.

![Checking network tab to see if script loads.](https://docs-resources.prod.twilio.com/8a2cd023e90dc07c18494061e6013d19469548d2b7a40f6f4dba91417b7d6b39.gif)

If the script isn't loading, check that any form of ad blocker is disabled.

## Settings

Segment lets you change these destination settings from the Segment app without having to touch any code.

| Field                       | Description                                                                                                                                                                                                  | Required | Type    |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------- | ------- |
| Ad Storage Consent Default  | The default value for ad storage consent state. This is only used if \*\*Enable Consent Mode\*\* is on.                                                                                                      | No       | select  |
| Ad Storage Consent Category | \[For Segment \[Consent Management]\(/docs/segment/privacy/consent-management/) users] The consent category to look up for Ad Storage consent value. This is only used if \*\*Enable Consent Mode\*\* is on. | No       | string  |
| Ad Storage Property Mapping | The property to lookup Ad Storage consent state from track or page events. Accepted values are \*\*granted\*\* or \*\*denied\*\*. This is only used if \*\*Enable Consent Mode\*\* is on.                    | No       | string  |
| Enable Consent Mode         | Set to true to enable Bing Ad's \[consent mode]\(https://help.ads.microsoft.com/#apex/ads/en/60119/1-500).                                                                                                   | No       | boolean |
| Tag ID                      | Your Bing Universal Event Tracking Tag ID                                                                                                                                                                    | Yes      | string  |
