> ## 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.

<Steps>
  <Step title="Sign in to Microsoft Advertising">
    Go to [ads.microsoft.com](https://ads.microsoft.com) and sign in to your account.
  </Step>

  <Step title="Navigate to Account Settings">
    Click on your account name in the top navigation → **Account settings**.
  </Step>

  <Step title="Enable Auto-tagging">
    Under **Tracking**, find the **Auto-tagging** option.

    Toggle it **ON** to automatically append msclkid to all ad URLs.
  </Step>

  <Step title="Save changes">
    Click **Save** to apply the setting.
  </Step>
</Steps>

## 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

<Steps>
  <Step title="Click one of your ads">
    Search for a term that triggers your ad and click through to your landing page.
  </Step>

  <Step title="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...`
  </Step>

  <Step title="Check Upstack Pixel Helper">
    If you have the [Upstack Pixel Helper](/guides/shopify/how-to-install-upstack-data-pixel-helper) installed, open it and verify that the `msclkid` is being captured.
  </Step>
</Steps>

## Troubleshooting

<AccordionGroup>
  <Accordion title="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>

  <Accordion title="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
    * Cookie consent is granted (if using consent mode)
  </Accordion>

  <Accordion title="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)
  </Accordion>
</AccordionGroup>

## 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.
</Note>

## Next steps

Once msclkid tracking is enabled:

* [Configure the destination in Upstack Data →](/guides/microsoft-ads/how-to-configure-microsoft-ads-destination)
* [Create Event Goals →](/guides/microsoft-ads/how-to-create-event-goals)
