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

# How to Enable msclkid Tracking for Microsoft Advertising

> Ensure msclkid (Microsoft Click ID) is captured and stored for attribution in Microsoft Advertising campaigns.

The **msclkid** (Microsoft Click ID) is a unique identifier appended to your landing page URLs when users click on Microsoft Advertising ads. Upstack captures this click ID and includes it with server-side events for accurate attribution.

## How msclkid works

1. User clicks your Microsoft ad
2. Microsoft appends `msclkid=XXXXXXXX` to the landing page URL
3. Upstack Pixel captures the `msclkid` from the URL
4. Upstack stores the `msclkid` in a first-party cookie
5. When the user converts, Upstack sends the `msclkid` with the server-side event
6. Microsoft matches the event to the original ad click

## Enable Auto-tagging (recommended)

Auto-tagging automatically appends `msclkid` to all ad click URLs. This is the recommended approach.

**1. Sign in to Microsoft Advertising**

Go to [ads.microsoft.com](https://ads.microsoft.com) and sign in to your account.

**2. Navigate to Account Settings**

Click on your account name in the top navigation → **Account settings**.

**3. Enable Auto-tagging**

Under **Tracking**, find the **Auto-tagging** option.

Toggle it **ON** to automatically append msclkid to all ad URLs.

**4. Save changes**

Click **Save** to apply the setting.

## Manual tracking (alternative)

If you need manual control over click ID tracking, add the `msclkid` parameter to your campaign tracking templates.

### Campaign-level tracking template

Add to your campaign's **Tracking template** field:

```
{lpurl}?msclkid={msclkid}
```

Or if you already have URL parameters:

```
{lpurl}&msclkid={msclkid}
```

### Account-level tracking template

Apply to all campaigns by setting the template at the account level:

1. Go to **Account settings** → **Tracking**
2. Add your tracking template with the `{msclkid}` parameter

## Verify msclkid is working

**1. Click one of your ads**

Search for a term that triggers your ad and click through to your landing page.

**2. Check the URL**

Look at the URL in your browser. You should see `msclkid=XXXXXXXX` as a URL parameter.

Example: `https://yourstore.com/products/item?msclkid=abc123def456...`

**3. Check Upstack Pixel Helper**

If you have the [Upstack Pixel Helper](https://docs.upstackdata.com/guides/pixel-helper/how-to-install-upstack-data-pixel-helper.md) installed, open it and verify that the `msclkid` is being captured.

## Troubleshooting

> [accordion] msclkid not appearing in URLs
>
> **Common causes:**
>
> * Auto-tagging is disabled — enable it in Account settings
> * Final URL excludes query parameters — check your ad configuration
> * Landing page redirects strip parameters — ensure redirects preserve query strings

> [accordion] msclkid appearing but not being tracked
>
> **Check these:**
>
> * Upstack Pixel is installed and active on your landing page
> * No JavaScript errors blocking the Upstack Pixel
> * Consent Mode isn't blocking the visitor: see [How to Configure Consent Mode](https://docs.upstackdata.com/guides/privacy/how-to-configure-consent-mode.md)

> [accordion] Attribution not working despite msclkid
>
> **Verify:**
>
> * The destination is configured with the correct UET Tag ID
> * Event Goals are created in Microsoft Advertising
> * Events are reaching Microsoft (check UET Tag Status)

## Cookie persistence

Upstack stores the `msclkid` in a first-party cookie to preserve attribution across sessions. The cookie persists for 90 days by default, matching Microsoft's conversion attribution window.

> [!NOTE]
>
> **Privacy considerations:** First-party cookies are more resilient to browser restrictions than third-party cookies, but may still be affected by ITP (Safari) and other privacy features. Server-side delivery helps maintain attribution accuracy in these cases.

## Next steps

Once msclkid tracking is enabled:

* [Configure the destination in Upstack Data →](https://docs.upstackdata.com/destinations/catalog/bing/how-to-configure-microsoft-ads-destination.md)
* [Create Event Goals →](https://docs.upstackdata.com/destinations/catalog/bing/how-to-create-event-goals.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.