Cookie Sync is a common technique for retargeting unknown visitors via the Ads platform. This document describes how Cookie Sync works between Treasure Data and Google Display & Video 360 (Google DV360).
Since 2021, Google has required customers to store the mapping/syncing of a td_global_id to Google's cookie ID in Google DV360. You'll use Treasure Data JavaScript SDK to upload a synced Treasure Data's td_global_id with Google Cookie to your Treasure Data account.
Example
A website visitor is assigned td_global_id 123 on a customer's website, while the visitor is also assigned a Google cookie ID ABC. The CDP must inform Google that Google's ABC and TD's 123 are the same visitor.
This topic contains:
- Implementing the Synchronization Process
- Synchronization Endpoint Sample
- Set up Segmentation
- Set up Google Display & Video 360 Authentication
- Set up Activation

Prepare the synchronization endpoint using TD JS SDK and populate the correct URL values.
https://cm.g.doubleclick.net/pixel?google_nid=treasuredata_dmp&google_hm=NThkOTVmNDAtMzAyOS00Y2FkLWIxYWQtM2ZlYWVmNzE5Njhk
- google_nid: 'treasuredata_dmp'
- google_hm: base64-encoded td_global_id value
Ref. https://developers.google.com/authorized-buyers/rtb/cookie-guide
Prepare a pixel tag to track the td_global_id with Google Cookie
The following code includes a sample tag for synchronizing and tracking the td_global_id with Google Cookie via pixel tag.
<script type="text/javascript">
!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=function(t){returnfunction(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(Array.prototype.slice.call(arguments)),this}},s=["blockEvents","unblockEvents","setSignedMode","setAnonymousMode","fetchUserSegments","resetUUID","fetchServerCookie","addRecord","fetchGlobalID","set","trackEvent","trackPageview","trackClicks","ready"],n=0;n<s.length;n++){var c=s[n];e[t].prototype[c]=r(c)}var o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=("https:"===document.location.protocol?"https:":"http:")+"//cdn.treasuredata.com/sdk/3.0/td.min.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(o,a)}}("Treasure",this);
// Generate a pixel tag for Cookie Sync
function googleSyncCallback() {
td.fetchGlobalID(
function(global_id) {
var gidsync_url = 'https://cm.g.doubleclick.net/pixel?';
var params = [
'google_nid=treasuredata_dmp',
'google_hm=' + btoa(global_id)
];
var img = new Image();
img.src = gidsync_url + params.join('&');
document.body.appendChild(img)
}
);
}
// Generate a general tracking tag
var td = new Treasure({
host: 'in.treasuredata.com',
writeKey: '<YOUR WRITE ONLY KEY>',
database: '<Your target Database>',
startInSignedMode: true
});
var tbl = 'cookie_sync_table';
td.set('$global', 'td_global_id', 'td_global_id');
// Syncted google_hm and td_global_id require to be a same value.
td.trackPageview(tbl, googleSyncCallback);
</script> Set up segments in TD Audience Studio to support your requirements.
You can authenticate Google Display & Video 360 Authentication by Google Partner ID or Google Advertiser ID. These are related but not identical concepts:
- Google Partner ID is for the enterprise customer of the DV360 platform.
- Google Advertiser ID is for a particular brand.
| Different outside ad agencies might manage the marketing and ads if a customer has multiple brands. So each brand may have a unique advertiser ID assigned, while the customer has a single Partner ID.
---|---
Set up your activation as follows.

| Field | Values | Description |
|---|---|---|
| Source column name mappings | cookie: cookie,list_name:list_name | The left side of the colon is Google's expected attribute, for example, cookie: or list_name: |
| The right side of the colon is the designated attribute name in the Activation. The value names are arbitrary. |

Field| Values| Description|
---|---|---|---
Column Mapping| Source: td_global_id
Output Column Name: cookie| The value is the data point that should be used as the cookie.
![]() | The Output Column Name displays on the Details tab. |
|---|
String Builder| String: xxx_DV360_Test_v2
Output Column Name: list_name| |
| The Output Column Name displays on the Details tab.
---|---