# Google Display Video 360での未知のVisitorのRetargeting

Cookie Syncは、Adsプラットフォームを介して未知のvisitorをretargetingするための一般的な手法です。このドキュメントでは、Treasure DataとGoogle Display & Video 360(Google DV360)の間でCookie Syncがどのように機能するかを説明します。
2021年以降、Googleは顧客にtd_global_idとGoogleのcookie IDのマッピング/同期をGoogle DV360に保存することを要求しています。Treasure Data JavaScript SDKを使用して、同期されたTreasure Dataのtd_global_idとGoogle CookieをTreasure アカウントにアップロードします。

**例**

ウェブサイトvisitorは顧客のウェブサイトでtd_global_id _123_を割り当てられ、同時にvisitorにはGoogle cookie ID _ABC_も割り当てられます。CDPは、GoogleのCookieである_ABC_とTDのcookieである_123_が同じvisitorであることをGoogleに通知する必要があります。

このトピックには以下が含まれます:

* [同期プロセスの実装](#implementing-the-synchronization-process)
* [同期エンドポイントサンプル](#synchronization-endpoint-sample)
* [segmentationのセットアップ](#set-up-segmentation)
* [Google Display & Video 360 authenticationのセットアップ](#set-up-google-display--video-360-authentication)
* [activationのセットアップ](#set-up-activation)


# 同期プロセスの実装

![](/assets/overview.69605299a336eb7722a74f0b4565a62113188b02b49d6fe4a2f1c17844974216.ad50cbca.png)

## 同期エンドポイントサンプル

TD JS SDKを使用して同期endpointを準備し、正しいURL値を入力します。

`https://cm.g.doubleclick.net/pixel?google_nid=treasuredata_dmp&google_hm=NThkOTVmNDAtMzAyOS00Y2FkLWIxYWQtM2ZlYWVmNzE5Njhk`

* google_nid: 'treasuredata_dmp'
* google_hm: base64エンコードされたtd_global_id値


参照: [https://developers.google.com/authorized-buyers/rtb/cookie-guide](https://developers.google.com/authorized-buyers/rtb/cookie-guide)

Google Cookieでtd_global_idを追跡するpixel tagを準備する

以下のコードには、pixel tagを介してGoogle Cookieでtd_global_idを同期および追跡するためのサンプルtagが含まれています。


```html
<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>
```

## segmentationのセットアップ

要件をサポートするために、TD Audience Studioで[segmentのセットアップ](/products/customer-data-platform/audience-studio/segment/segments-overview)を行います。

## Google Display & Video 360 authenticationのセットアップ

Google Display & Video 360 authenticationは、Google Partner IDまたはGoogle Advertiser IDで認証できます。これらは関連していますが、同一の概念ではありません:

* Google Partner IDは、DV360プラットフォームのエンタープライズ顧客向けです。
* Google Advertiser IDは、特定のブランド向けです。


![Information](/assets/info.aa88698bdb590fb167080bc7bc900e461aa937f4b3774de0759e678e7a8aab37.ad50cbca.png) | 顧客が複数のブランドを持っている場合、異なる外部広告代理店がマーケティングと広告を管理する可能性があります。したがって、各ブランドには一意のadvertiser IDが割り当てられる可能性がありますが、顧客には単一のPartner IDがあります。

---|---

## activationのセットアップ

以下のようにactivationをセットアップします。

![](/assets/image2023-5-22_15-8-33.a95b103d9914ec9b47a92983706e0c43ee559800843036abf60453e6a10c6487.ad50cbca.png)

| Field | Values | Description |
|  --- | --- | --- |
| Source column name mappings | cookie: cookie,list_name:list_name | コロンの左側は、Googleが期待する属性です。たとえば、cookie:またはlist_name: |
| コロンの右側は、Activationで指定された属性名です。値名は任意です。 |  |  |


![](/assets/image2023-5-22_15-55-12.029a9002378a024dea0f633690807c41d1b10d5bff9659f10227b6834a50a620.ad50cbca.png)

Field| Values| Description|
---|---|---|---
Column Mapping| Source: td_global_id
Output Column Name: cookie| 値は、cookieとして使用されるべきdata pointです。

| ![Information](/assets/info.aa88698bdb590fb167080bc7bc900e461aa937f4b3774de0759e678e7a8aab37.ad50cbca.png) | Output Column NameはDetailsタブに表示されます。 |
|  --- | --- |


String Builder| String: xxx_DV360_Test_v2
Output Column Name: list_name| | ![Information](/assets/info.aa88698bdb590fb167080bc7bc900e461aa937f4b3774de0759e678e7a8aab37.ad50cbca.png) | Output Column NameはDetailsタブに表示されます。
---|---