> ## Documentation Index
> Fetch the complete documentation index at: https://docs.segmentstream.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Advertising

> Connect Microsoft Advertising to SegmentStream and import campaign cost data.

## Getting started

<Steps>
  <Step title="Navigate to Data Sources">
    Inside the admin panel navigate to the **Data Sources** page and click **+ NEW** on the top right corner.
  </Step>

  <Step title="Select Microsoft Advertising">
    Choose **Microsoft Advertising** from the list.
  </Step>

  <Step title="Authenticate">
    Click **Authenticate with Microsoft** and go through the authentication flow.
  </Step>

  <Step title="Select account">
    Select the advertising account you would like to connect.
  </Step>

  <Step title="Save">
    Click **Save**.
  </Step>
</Steps>

## UTM tagging best practices

Adding a `utm_id` parameter to your ads URLs will guarantee improved stitching quality of costs to sessions without altering the rest of your existing UTM tags.

<Steps>
  <Step title="Open account-level options">
    In the left side menu, select **Campaigns** > **Settings** > **Account level options**.
  </Step>

  <Step title="Add the utm_id parameter">
    Add `utm_id={CampaignId}_{AdGroupId}_{AdId}` in the **Final URL suffix** field.
  </Step>

  <Step title="Test">
    Click **Test** to check if the URL contains the `utm_id` parameter.
  </Step>

  <Step title="Save">
    Click **Save**.
  </Step>
</Steps>

Once the `utm_id` parameter is implemented, sessions will be stitched with costs at the ad level. The Campaign, Ad Group, and Ad Name dimensions of the SegmentStream reports will display the Microsoft Advertising campaign name, ad group name, and ad name, respectively.

## Supported dynamic URL parameters

By default Microsoft Advertising allows the use of [dynamic URL tracking parameters](https://help.ads.microsoft.com/#apex/3/en/56799/2) to track campaigns.

SegmentStream supports the following parameters:

| Name             | Description                                                                                                                                             |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `{lpurl}`        | The final URL. It will be escaped unless you put `{lpurl}` at the beginning of your tracking template.                                                  |
| `{CampaignId}`   | The ID of the campaign that triggered the ad.                                                                                                           |
| `{Campaign}`     | The name of the campaign that triggered the ad.                                                                                                         |
| `{AdGroupId}`    | The ID of the ad group that triggered the ad.                                                                                                           |
| `{AdGroup}`      | The name of the ad group that triggered the ad.                                                                                                         |
| `{MatchType}`    | The match type used to deliver an ad: `e` for exact, `p` for phrase, `b` for broad. Expanded match is treated as broad match.                           |
| `{BidMatchType}` | The keyword bid match type: `be` for bidded exact, `bp` for bidded phrase, `bb` for bidded broad.                                                       |
| `{Network}`      | The ad network type: `o` for owned and operated (Bing, AOL, Yahoo), `s` for syndicated (search partner), `a` for audience (Microsoft Audience Network). |
| `{Device}`       | The device type: `m` for mobile, `t` for tablet, `c` for desktop or laptop.                                                                             |
| `{AdId}`         | The numeric ID of the displayed ad.                                                                                                                     |
| `{keyword}`      | The keyword that matched the user's search term.                                                                                                        |

<Note>
  If you use unsupported parameters in UTM tags, you will see the parameter names in SegmentStream reports instead of their values (for example, `{OrderItemId}` instead of `1234567890`). For better stitching quality, move unsupported parameters from UTM tags to additional custom GET parameters.
</Note>
