Match tag

The match tag is a small piece of code provided by The Trade Desk that you place on a website or within ads to enable cookie mapping (also known as cookie syncing). It associates The Trade Desk ID (TDID) with a partner's unique user ID for a browser or device, enabling both systems to recognize and measure activity across platforms.

TIP: If you need real-time data processing for cookie mapping, see Real-time ID tag.

Here's what you need to know:

The following sections describe the workflow for implementing the match tag.

Workflow overview

The cookie mapping workflow consists of the following steps:

  1. Setup
  2. Initiation
  3. Redirecting URLs
  4. Storing and sending back TDIDs
  5. Handling non-persistent TDIDs

Setup

Before you get started, be sure to contact your Technical Account Manager to have your account provisioned with the proper permissions.

Information you need to provide

Provide your Technical Account Manager with the following information.

Information Description
Cookie-mapping pixel redirect URL The secure (https://) URL to which The Trade Desk platform should issue a 302 redirect when it receives cookie mapping requests from you.

IMPORTANT: Use the match tag responses in the Redirecting URLs section as examples and be sure to include the macro codes listed for each parameter that you want to include in your redirect URL.

Information you need to receive

After the cookie-mapping pixel redirect URLs that you provide are set up as described in the Redirecting URLs section, the following information will be generated and provided to you by your Technical Account Manager.

Information Description
ttd_pid The unique cookie partner ID assigned to your organization.
Match tag URL The match tag to implement on accessible web properties on your website.

Call the match tag

Place The Trade Desk match tag on your website in accessible web properties, where it can be called to initiate cookie mapping.

The following match tag example shows how to initiate cookie mapping using a ttd_pid and ttd_puid value.

<img height="1" width="1" style="border-style:none;" alt="" src="https://match.adsrvr.org/track/cmf/generic?ttd_pid={COOKIE_PARTNER_ID_PLACEHOLDER}&ttd_puid={OPTIONAL_ID_PLACEHOLDER}&ttd_tpi=1&gdpr=0"/>

The match tag supports the following parameters in the src attribute.

Parameter Required? Description When to send it Example value
ttd_pid Required A unique cookie partner ID assigned to your organization by The Trade Desk. Always include this parameter. cookiepartnerid
ttd_id Conditionally required The platform unique cookie ID for this user. If you already have the ttd_id parameter on file for this user, send this in addition to the ttd_pid parameter. 1a2b3c4d-5e6f-7g8h-9i10-j11k12l13m14
ttd_puid Optional A unique user ID that you can assign to include unique identifiers you'd like to send and receive back with your cookie mapping request. Send one ttd_puid parameter per unique ID. 123 or 456
ttd_tpi Required A parameter that indicates whether the request was initiated by a third party. Always include this parameter and set it to 1. 1
gdpr Recommended The General Data Protection Regulation (GDPR) requirements. Possible values include the following:
  • 0 (GDPR does not apply to this cookie.)
  • 1 (GDPR applies to this cookie.)
See also Data privacy.
The Trade Desk recommends including this parameter in all requests. 0 or 1
gdpr_consent Conditionally required This parameter accepts a base64url-encoded GDPR consent string.
The parameter value provides information about vendor consent.
This parameter is required only when gdpr=1.
The Trade Desk writes a cookie only when gdpr=1 and if the user consent string is provided and validated.
BOEFBi5OEFBi5AHABDENAI4AAAB9vABAASA
ttd_passthrough Optional A parameter that enables you to send one or more URL-encoded pass-through parameters in the URL. If your implementation includes one or more custom parameters that you want The Trade Desk to pass through, such as unique values for each ad, send them in the ttd_passthrough parameter. The Trade Desk passes this value on to you, unchanged, appended to the redirect URL. For examples of how to construct this parameter, see Pass-through parameter. example_creative%3D602206%26example_videoid%3D1234B5678901FA
domain Conditionally required The website domain where the cookie mapping is initiated.
If the user is subject to GDPR, and no IAB Transparency & Consent Framework (TCF) consent details are provided, the domain must match one of the pre-approved domains for the cookie partner. If there is no match, cookie mapping fails, and there is no redirect with a TDID.
For details, see Domain parameter.
An advertiser website with a significant volume of European visitors is subject to GDPR. If you are performing cookie mapping on a website subject to GDPR that does not provide the IAB TCF parameters, include the domain parameter. www.example.com
subdomain.example.com

Pass-through parameter

To send data that is specific to your implementation, use the ttd_passthrough parameter. The Trade Desk passes these values without processing or changing the data.

Here are the key points about the pass-through parameter:

The following example shows the pattern for pass-through parameter values before encoding.

ttd_passthrough={PARAM1_NAME}={PARAM1_VALUE}&{PARAM2_NAME}={PARAM2_VALUE}&{PARAM3_NAME}={PARAM3_VALUE}

After applying the necessary URL encoding, the pattern is as follows:

ttd_passthrough={PARAM1_NAME}%3D{PARAM1_VALUE}%26{PARAM2_NAME}%3D{PARAM2_VALUE}%26{PARAM3_NAME}%3D{PARAM3_VALUE}

The following example passes through one parameter with parameter name example_creative and value 602206:

ttd_passthrough=example_creative%3D602206

The unencoded representation of this pass-through parameter is as follows:

example_creative=602206

The following example passes through two parameters and their values, with associated encoding:

ttd_passthrough=example_creative%3D602206%26example_videoid%3D1234B5678901FA

The unencoded representation of these two parameters, passed as the value of the ttd_passthrough parameter, is as follows:

example_creative=602206&example_videoid=1234B5678901FA

You can send more than two pass-through parameters, following the same pattern.

Domain parameter

If you're providing the domain parameter (see Call the match tag), the value must match the following rules.

Include only the following:

Do not include the following:

Valid examples:

Examples of invalid values for the domain parameter:

If you're populating the domain parameter using JavaScript, you might be able to use the window.location.hostname property. However, if the JavaScript is running in an iframe, window.location.hostname returns the domain of the iframe. In this scenario, you would need to add some logic to retrieve the hostname of the parent window.

Request examples

The following table shows examples of cookie mapping requests for various user types.

User Type Example
Unknown ttd_id value https://match.adsrvr.org/track/cmf/generic?ttd_pid=cookiepartnerid&ttd_puid=123&ttd_puid=456&ttd_tpi=1&domain=example.com
Unknown ttd_id value covered by GDPR with user consent https://match.adsrvr.org/track/cmf/generic?ttd_pid=cookiepartnerid&ttd_puid=123&ttd_puid=456&ttd_tpi=1&gdpr=1&gdpr_consent=BOEFBi5OEFBi5AHABDENAI4AAAB9vABAASA
Known ttd_id value https://match.adsrvr.org/track/cmf/generic?ttd_id=1a2b3c4d-5e6f-7g8h-9i10-j11k12l13m14&ttd_puid=123&ttd_puid=456&ttd_tpi=1
Known ttd_id value covered by GDPR with user consent https://match.adsrvr.org/track/cmf/generic?ttd_id=1a2b3c4d-5e6f-7g8h-9i10-j11k12l13m14&ttd_puid=123&ttd_puid=456&ttd_tpi=1&gdpr=1&gdpr_consent=BOEFBi5OEFBi5AHABDENAI4AAAB9vABAASA
In a location covered by GDPR https://match.adsrvr.org/track/cmf/generic?ttd_pid=cookiepartnerid&ttd_puid=123&ttd_tpi=1&domain=example.com
NOTE: The domain parameter is required because the request does not include IAB TCF parameters.

Redirecting URLs

The Trade Desk tag records incoming requests to capture the platform unique ID and issues a 302 redirect to the cookie-mapping pixel URL that you provided during setup.

The platform can pass back to you the following parameters: ttd_id, ttd_puid, gdpr, and gdpr_consent.

Parameter Description Macro to include in redirect URL
ttd_puid Optional, unique user IDs that you assign.
If you provided multiple ttd_puid parameters with the request, the platform returns a comma-separated list of the ttd_puid IDs that you provided.
%%PARTNER_UID%%
ttd_id The platform unique cookie ID for this user. %%TDID%%
gdpr 0 indicates that GDPR does not apply to this cookie.
1 indicates that GDPR does apply to this cookie.
%%GDPR_APPLIES%%
gdpr_consent This parameter accepts a base64url-encoded GDPR consent string.
The parameter value provides information about vendor consent.
Note that if you send a request where gdpr=1 and the gdpr_consent parameter is not present or does not validate, The Trade Desk does not set a cookie or return a ttd_id.
%%GDPR_CONSENT_STRING%%

NOTE: The platform does not redirect all received cookie mapping requests. If a user cookie is determined as not persistent, no requests are returned.

Here's the decision process:

  1. The Trade Desk checks to see if the user has an existing cookie with us:
    • If so, the platform reads the user's cookie and return the ID to you along with any ttd_puid that you might have sent.
    • If the user does not have an existing cookie with us, the platform writes a new cookie on that user's browser.
  2. The Trade Desk makes an internal hop to read that user's new cookie:
    • If the platform can read the cookie, it returns the ID to you along with any ttd_puid that you may have sent.
    • If the platform cannot read the cookie, it drops the request and does not return an ID.
      This happens in around 10-15% of cookie mapping requests. It generally happens when a user has blocked third-party cookies set as their default or has a cookie-blocking extension installed in their browser. If the user is blocking third-party cookies, the platform doesn't want to store or transmit cookies that are not targetable, since they do not exist beyond one page load.

For example, if you have the following redirect URL:

https://example.com/sync?ttd_puid=%%PARTNER_UID%%&ttd_id=%%TDID%%&gdpr=%%GDPR_APPLIES%%&gdpr_consent=%%GDPR_CONSENT_STRING%%

The platform will respond back with the following:

https://example.com/sync?ttd_puid=123,456&ttd_id=1a2b3c4d-5e6f-7g8h-9i10-j11k12l13m14&gdpr=1&gdpr_consent=BOEFBi5OEFBi5AHABDENAI4AAAB9vABAASA

Here are other examples of redirect URLs:

https://map.example.com/partner/12345/sync?uid=%%TDID%%&_origin=1&gdpr=%%GDPR_APPLIES%%&gdpr_consent=%%GDPR_CONSENT_STRING%%&piggybackCookie=%%TDID%%
https://map.example.com/sync/v1?source_id=hash123&source_user_id=%%TDID%%&gdpr=%%GDPR_APPLIES%%&gdpr_consent=%%GDPR_CONSENT_STRING%%

Storing and sending back TDIDs

You must store TDIDs that The Trade Desk platform sends to you. You then send them back to us when you create segments by using the first-party POST /data/advertiser or third-party POST /data/thirdparty endpoints.

Handling non-persistent TDIDs

TDIDs derived from web browsers such as Safari and Firefox, which block third-party cookies by default, become non-persistent. This means that these TDIDs may never be seen again during bidding time.

From the targeting perspective, you have the following options for handling non-persistent TDIDs.

Option Impact
Include non-persistent IDs in your audiences. A large percentage of those included user IDs will not be targetable.
Exclude non-persistent IDs from any audiences sent over to the Data APIs. A small percentage of persistent IDs may be lost.

From a measurement perspective, the non-persistent TDIDs are likely to produce low-match rates so it is best to exclude them from upstream events.

TIP: You can find user agent and additional metadata within the headers from the redirect URLs of the match tag.

Data privacy

Data protection laws provide requirements for the use of cookies and pixel technology in European regions. Consent must be obtained from users before cookies can be used for advertising purposes, including cookie mapping, retargeting and reporting.

Request examples for GDPR-regulated users

If you have the user's consent to write a cookie to their browser, pass gdpr=1 and include the user's consent string in the gdpr_consent parameter.

https://match.adsrvr.org/track/cmf/generic?ttd_pid=cookiepartnerid&ttd_tpi=1&gdpr=1&gdpr_consent=BOEFBi5OEFBi5AHABDENAI4AAAB9vABAASA

If the consent string is not included when gdpr=1 is passed, the platform will not write a cookie for the user.

Request examples for Non-GDPR regulated users

If the user is not regulated by GDPR, pass gdpr=0.

https://match.adsrvr.org/track/cmf/generic?ttd_pid=cookiepartnerid&ttd_tpi=1&gdpr=0

For requests where gdpr=0 and the request passes validation, the platform will write a cookie and respond with the associated ttd_id.