# Bing Ads

HockeyStack's Bing Ads integration pulls your campaign data into HockeyStack and connects it with your marketing, revenue, and product data. This allows you to track through your ad spend and ad insight data.

A Microsoft 365 Admin account is required to approve the Bing Ads integration with HockeyStack.

## How to Connect

1. Navigate to Atlas > Ingest and click on Integrations
2. Click the Configure button for Bing Ads
3. If your organization uses SSO, input your Microsoft Entra tenant ID or domain and click Connect\ <img src="/files/RZifzKhJSJn4uME3p5QD" alt="" data-size="original">
4. Else, click the Connect button and log in on the pop-up window\
   ![](/files/VXrlAh4Vlq5X8MSBvX1V)

## What Data Gets Tracked as Metadata

The following fields are tracked and stored during the integration process:

| **Field**           | **Description**                                                       |
| ------------------- | --------------------------------------------------------------------- |
| `account_id_hashed` | A hashed version of the account ID for secure storage.                |
| `type`              | The type of tracked data, such as `paid-ads`.                         |
| `date`              | The date of the ad activity, formatted as `YYYY-MM-DD`.               |
| `id`                | A unique identifier for each data row, generated as an MD5 hash.      |
| `metadata`          | A JSON object containing detailed metadata about the campaign and ad. |
| `account_id`        | The original account ID associated with the ad.                       |
| `network`           | The advertising network, such as `Bing Ads`.                          |
| `campaign_id`       | The unique ID of the campaign.                                        |
| `adgroup_id`        | The unique ID of the ad group.                                        |
| `ad_id`             | The unique ID of the ad.                                              |
| `campaign_name`     | The name of the campaign.                                             |
| `adgroup_name`      | The name of the ad group.                                             |
| `ad_name`           | The name of the ad.                                                   |
| `keyword`           | The keyword associated with the ad.                                   |
| `utm_source`        | The source of the traffic, such as `bing`.                            |
| `utm_campaign`      | The campaign name, URL-encoded if necessary.                          |
| `utm_medium`        | The medium of the traffic, such as `paid`.                            |
| `utm_content`       | Content-specific identifier for the campaign.                         |
| `utm_term`          | The keyword associated with the campaign, if applicable.              |
| `impressions`       | The total number of impressions for the ad.                           |
| `clicks`            | The total number of clicks for the ad.                                |
| `cost`              | The total cost of the ad campaign in the specified currency.          |
| `currency`          | The currency in which the ad costs are measured (e.g., `USD`).        |

## High-Level Integration Flow

1. **Ad Data Retrieval**:
   * Campaign, ad group, and ad data are fetched using the Bing Ads API.
   * Performance metrics, including impressions, clicks, and costs, are retrieved for each campaign.
2. **Analytics and Data Processing**:
   * The integration processes raw data into a structured format.
   * Impressions, clicks, and cost metrics are extracted and formatted.
3. **Data Formatting**:
   * The `formatData` function processes the raw data into a structured format, ensuring consistency in metadata.
4. **Data Insertion**:
   * Formatted data is stored in the metadata system using `insertToMetadata`.
   * The account’s `lastPulledDate` is updated to avoid duplicate data processing.

## Notes and Caveats

* **Token Handling**:
  * The integration uses BING\_CID and BING\_CS to authenticate all requests to the Bing Ads API
  * token is refreshed every time&#x20;

For more information about metadata, check out our documentation article on the HockeyStack Data Model: [The HockeyStack data model](/marketing-intelligence/the-hockeystack-data-model.md)


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hockeystack.com/integrations/ad-platforms/bing-ads.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
