---
title: MGID Cookie Matching Guide for SSPs
description: Cookie matching - this is a way of collecting information about the same user by linking his identifiers from different sources. UUID - unique user ID in the system. Most often it is a cookie file. Fo
---

[Skip to content](https://help.mgid.com/mgid-cookie-matching-guide#main-content)

English

Show submenu for translations

![MGID\_Logo\_Help\_Center\_W\_R\_Swoosh.svg\]](https://help.mgid.com/hubfs/MGID_Logo_Help_Center_W_R_Swoosh.svg)

- [Advertisers](https://www.mgid.com/advertisers)
- [Publishers](https://www.mgid.com/publishers)
- [Contact Us](https://www.mgid.com/about#tabs-contactus)

Open main navigation

Close main navigation

- [Advertisers](https://www.mgid.com/advertisers)
- [Publishers](https://www.mgid.com/publishers)
- [Contact Us](https://www.mgid.com/about#tabs-contactus)
- English
  
  Show submenu for translations
- Contact us

 Contact us

 Welcome to MGID! How can we help you?

- There are no suggestions because the search field is empty.

1. [Help Center Home](https://help.mgid.com/?hsLang=en)
2. [SSP](https://help.mgid.com/ssp?hsLang=en)

# MGID Cookie Matching Guide for SSPs

[How Cookie Matching Works](https://help.mgid.com/mgid-cookie-matching-guide#toc1)

[Cookie Matching Scenarios](https://help.mgid.com/mgid-cookie-matching-guide#toc2)

[Inverse Mode](https://help.mgid.com/mgid-cookie-matching-guide#toc3)

[Macros and Parameters](https://help.mgid.com/mgid-cookie-matching-guide#toc4)

[Result in Bid Requests](https://help.mgid.com/mgid-cookie-matching-guide#toc5)

[Choosing the Integration Scenario](https://help.mgid.com/mgid-cookie-matching-guide#toc6)

Cookie matching allows MGID (DSP) and a Partner (SSP) to associate their user identifiers. This enables the Partner to pass both the Partner's user ID and the MGID user ID in an OpenRTB Bid Request when the user has been successfully matched.

### How Cookie Matching Works

MGID and the Partner use their own user identifiers. Cookie matching creates a mapping between these identifiers.

For a successfully matched user, the Partner includes both identifiers in the OpenRTB Bid Request sent to MGID:

- \`user.id\` - the Partner's user ID (SSP ID).
- \`user.buyeruid\` -  the MGID user ID (DSP ID).

For a user who has not been matched yet, only the Partner's user ID is available in the Bid Request.

The matching process is based on redirects between MGID and the Partner. Depending on which platform initiates the sync and where the mapping is stored, there are different integration scenarios.

### Cookie Matching Scenarios

**1. MGID initiates the sync, and both MGID and the Partner store the mapping**

The Partner provides MGID with a user synchronization URL. MGID initiates the synchronization by calling the Partner's sync endpoint.

The Partner's sync endpoint must accept the MGID user ID and redirect the request back to the MGID sync endpoint.

MGID expects:

1. The Partner's cookie sync URL.
2. The Partner's user ID to be passed back to the MGID sync endpoint.

Example:

```
https://partnerURL.com/sync?gdpr={GDPR}&gdpr_consent={GDPR_CONSENT}&gpp=${GPP_STRING}&gpp_sid=${GPP_SID}&redirect_url=https://cm.mgid.com/m?cdsp=123456&c={user.id}
```

**The flow is:**  MGID - Partner - MGID.

Both MGID and the Partner store the mapping between their user IDs.

**2. MGID initiates the sync, and only the Partner stores the mapping**

MGID initiates the synchronization by calling the Partner's sync URL. MGID passes its user ID to the Partner using the \`user\_id\` parameter.

Example:

```
https://partnerURL.com/sync?user_id={muidn}&gdpr={GDPR}&gdpr_consent={GDPR_CONSENT}&gpp=${GPP_STRING}&gpp_sid=${GPP_SID}
```

The Partner is responsible for storing the mapping between the MGID user ID and the Partner user ID.

**The flow is:** MGID - Partner.

Only the Partner stores the mapping.

**3. Partner initiates the sync, and MGID stores the mapping**

The Partner initiates the synchronization by calling the MGID sync endpoint.

The Partner should provide:

- its own user ID using the \`{user.id}\` macro;
- its redirect URL using the \`adu\` parameter.

Example:

```
https://cm.mgid.com/m?cdsp=123456&c={user.id}&gdpr={GDPR}&gdpr_consent={GDPR_consent_string}&gpp=${GPP_STRING}&gpp_sid=${GPP_SID}&adu=https://partnerRedirectUR.com/sync?user_id={muidn}
```

**The flow is:**  Partner - MGID - Partner.

MGID stores the mapping between the Partner user ID and the MGID user ID.

### Inverse Mode

The \`mode=inverse\` parameter defines the direction in which the user ID mapping is stored.

In the regular mode, the mapping is stored as: muidn = externalID

Here, \`muidn\` is the MGID user ID and \`externalID\` is the Partner's user ID.

With \`mode=inverse\`, the mapping is stored in the opposite direction: externalID = muidn

The Partner's user ID is therefore used as the key to find the corresponding MGID user ID.

**When to use mode=inverse**

Use \`mode=inverse\` when the integration requires MGID to find its own \`muidn\` using the Partner's \`externalID\`.

This is typically relevant when MGID stores the mapping and later needs to resolve an MGID user ID based on an ID provided by the Partner, for example in traffic acquisition scenarios.

For example:

```
Partner externalID: abc123MGID muidn: 987654
```

- Regular mapping: 987654 - abc123
- Inverse mapping: abc123 - 987654

The inverse mapping allows MGID to receive the Partner's \`externalID\` and resolve it to the corresponding \`muidn\`.

**When mode=inverse is not required**

Traffic acquisition by itself does not mean that \`mode=inverse\` should be used.

If the Partner initiates the request and already provides the MGID user ID in \`user.buyeruid\`, there is no need to use \`inverse\` just to obtain the \`muidn\` — the MGID user ID is already available in the Bid Request.

\`mode=inverse\` is relevant when:

1. MGID needs to store the mapping.
2. The Partner's \`externalID\` is available.
3. MGID needs to use that \`externalID\` later to find the corresponding \`muidn\`.

**Does MGID need to find its \`muidn\` by the Partner's \`externalID\` later?**

If yes, use \`mode=inverse\`. If the \`muidn\` is already provided in \`user.buyeruid\` and no lookup by \`externalID\` is required, \`mode=inverse\` is not needed.

### Macros and Parameters

| **Parameter / Macro** | **Description** |
| --- | --- |
| {GDPR} | \`0\` if the user is not subject to GDPR; \`1\` if the user is subject to GDPR. |
| {GDPR\_CONSENT} | IAB consent string when the request is subject to GDPR. |
| ${GPP\_STRING} / ${GPP\_SID} | GPP consent string and the corresponding GPP section IDs when applicable. |
| {user.id} | Partner-specific user identifier. In the Partner context, this represents the Partner's user ID. |
| {muidn} | MGID-specific user identifier. |

Macro values shown above are literal placeholders. They are replaced with the corresponding value when the sync URL is executed.

### Result in Bid Requests

Once the user IDs have been successfully matched, the Partner includes both identifiers in the OpenRTB Bid Request sent to MGID:

```
user.id - Partner/SSP user IDuser.buyeruid - MGID/DSP user ID
```

If no matching record exists, the Partner sends only:

```
user.id - Partner/SSP user ID
```

MGID can then use \`user.buyeruid\` to identify the corresponding MGID user.

### Choosing the Integration Scenario

The appropriate scenario depends on:

- which platform initiates the synchronization;
- whether MGID stores the user ID mapping;
- whether the Partner stores the user ID mapping;
- whether MGID needs to resolve its \`muidn\` from the Partner's \`externalID\`.

If you are unsure which scenario is applicable to your integration, contact your MGID technical representative before implementing the sync.

- [Advertisers](https://help.mgid.com/advertisers?hsLang=en#main-content)

    - [Get started with MGID Ads](https://help.mgid.com/advertisers?hsLang=en#get-started-with-mgid-ads)
    - [Campaign Setup & Management](https://help.mgid.com/advertisers?hsLang=en#campaign-setup-management)
    - [CPA Tune](https://help.mgid.com/advertisers?hsLang=en#cpa-tune)
    - [Conversion tracking: general](https://help.mgid.com/advertisers?hsLang=en#conversion-tracking-general)
    - [Tracking with MGID Pixel](https://help.mgid.com/advertisers?hsLang=en#tracking-with-mgid-pixel)
    - [Postback & Trackers](https://help.mgid.com/advertisers?hsLang=en#postback-trackers)
    - [Affiliate Networks Integration](https://help.mgid.com/advertisers?hsLang=en#affiliate-networks-integration)
    - [Webhook tracking method & Integrations](https://help.mgid.com/advertisers?hsLang=en#webhook-tracking-method-integrations)
    - [Native integrations](https://help.mgid.com/advertisers?hsLang=en#native-integrations)
    - [Ad Creatives Management](https://help.mgid.com/advertisers?hsLang=en#ad-creatives-management)
    - [Campaign Optimization & Performance](https://help.mgid.com/advertisers?hsLang=en#campaign-optimization-performance)
    - [FAQ](https://help.mgid.com/advertisers?hsLang=en#faq)
    - [MGID Video Guides](https://help.mgid.com/advertisers?hsLang=en#mgid-video-guides)
- [Publishers](https://help.mgid.com/publishers?hsLang=en#main-content)

    - [General](https://help.mgid.com/publishers?hsLang=en#general)
    - [Prohibited content and practices](https://help.mgid.com/publishers?hsLang=en#prohibited-content-and-practices)
    - [Types of integration](https://help.mgid.com/publishers?hsLang=en#types-of-integration)
    - [Compliance](https://help.mgid.com/publishers?hsLang=en#compliance)
    - [Payment](https://help.mgid.com/publishers?hsLang=en#payment)
    - [FAQ](https://help.mgid.com/publishers?hsLang=en#faq)
- [Ad Quality Policies and Creative Guidelines](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#main-content)

    - [Ad Approval & Compliance Guidelines](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#ad-approval-compliance-guidelines)
    - [Creative AI Hub](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#creative-ai-hub)
    - [Creative Hub](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#creative-hub)
    - [Compliance & Security](https://help.mgid.com/ad-quality-policies-and-creative-guidelines?hsLang=en#compliance-security)
- [Advertisers Super Client Account](https://help.mgid.com/advertisers-super-client-account?hsLang=en#main-content)

    - [Clients](https://help.mgid.com/advertisers-super-client-account?hsLang=en#clients)
- [Fraud Prevention](https://help.mgid.com/fraud-prevention?hsLang=en#main-content)

    - [Fraud Prevention](https://help.mgid.com/fraud-prevention?hsLang=en#fraud-prevention)
- [API](https://help.mgid.com/api?hsLang=en)
- [DSP](https://help.mgid.com/dsp?hsLang=en)
- [SSP](https://help.mgid.com/ssp?hsLang=en)

- [Advertisers](https://www.mgid.com/advertisers)
- [Publishers](https://www.mgid.com/publishers)
- [Contact Us](https://www.mgid.com/about#tabs-contactus)

[![Chill listening crop-3](https://help.mgid.com/hubfs/MGID_Logo_Icon_HC.svg "Chill listening crop-3")](https://www.mgid.com)

Native performance through innovation

<https://facebook.com/mgidglobal/> <https://twitter.com/mgid/> <https://www.linkedin.com/company/mgid-inc->

Copyright © 2026, MGID Inc.