# Use the Profiles API With Google DFP Doubleclick for Publishers You can integrate Treasure Data’s Profiles API Token with Google DFP (DoubleClick for Publishers). This integration allows advertisers to put ads on the segments you have defined in Treasure Data. * [Prerequisites](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#prerequisites) * [Create the Profiles API Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#create-the-profiles-api-token) * [Name Your New Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#name-your-new-token) * [Configure the Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#configure-the-token) * [Add Segments to the Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#add-segments-to-the-token) * [Integrating the Profiles API Token with Google DFP](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#integrating-the-profiles-api-token-with-google-dfp) * [Configure Google DFP for use with the Profiles API Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#configure-google-dfp-for-use-with-the-profiles-api-token) * [Create JavaScript DFP and Treasure Data Tags](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#create-javascript-dfp-and-treasure-data-tags) # Prerequisites * Basic knowledge of JavaScript and HTML * Basic knowledge of Treasure Data * Basic knowledge of Treasure Data JavaScript SDK * Basic knowledge of Treasure Data Profiles API Token * Basic knowledge of Google DFP (DoubleClick for Publishers) # Create the Profiles API Token ## Name Your New Token 1. Open TD Console. 2. Navigate to Audience Studio and select a segment. 3. Select a folder. 4. Select Create New. 5. Select Profiles API Token. ![](/assets/profileapitoken.bea076622b597c1a6dceff6cf17281c185891e4c46a25d693ec373a3e691613c.cf3845cb.png) 1. Enter a name for your token and optionally enter a description. Select Next. ## Configure the Token The name and description carry over from when you named the token. You can make changes. 1. Enter a **Lookup Key**. A Lookup Key is a column with a unique value inside the Parent Segment. This lookup key identifies the correct profile. ![Note](/assets/note.767ca0ca6d076817a978148fbb7dd2a68ca7d067ced0ff61bfb3be582d0426d9.cf3845cb.png) **Note:** The lookup key update will take effect once the token workflow finishes. When using `td_global_id` as the lookup key, the Profiles API retrieves the lookup value from the browser cookie instead of the API request's query param. For testing or verification purposes outside of a browser (eg, Postman), use a different column to pass in the lookup value manually. 1. (Optional) Enter a maximum of five Attributes. Profile attributes can be returned from the profile token when queried 2. Choose one of the following: * Select Next to continue and add Segments. * Select Create to configure the token. (You can add segments later if you want.) ## Add Segments to the Token 1. Choose one of the following: * After you configure your token, select **Next**. * Navigate to Audience Studio > Folder > Profiles API Token. 1. Add Segments to your Profiles API Token. 2. Select **Save**. # Integrating the Profiles API Token with Google DFP Complete the steps in the following sections to integrate the Profiles API Token with Google DFP: * [Prerequisites](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#h1_1644201065) * [Create the Profiles API Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#h1__441927612) * [Name Your New Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#UsetheProfilesAPIwithGoogleDFPDoubleClickforPublishers-NameYourNewToken) * [Configure the Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#UsetheProfilesAPIwithGoogleDFPDoubleClickforPublishers-ConfiguretheToken) * [Add Segments to the Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#UsetheProfilesAPIwithGoogleDFPDoubleClickforPublishers-AddSegmentstotheToken) * [Integrating the Profiles API Token with Google DFP](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#h1__115221623) * [Configure Google DFP for use with the Profiles API Token](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#h2__631907321) * [Create JavaScript DFP and Treasure Data Tags](/products/customer-data-platform/audience-studio/profiles/use-the-profiles-api-with-google-dfp-doubleclick-for-publishers#h2_1416520366) ## Configure Google DFP for use with the Profiles API Token 1. In your web browser, navigate to Google DFP. 2. Navigate to **Inventory** >**Key-values**. ![](/assets/image-20190817-005708.9caf71ecf421c74fe5ce429e2d969ff9de4c37c2c0936972a00f69651f6be527.cf3845cb.png) 1. Select New Key. 2. Complete the Name and Display name fields. ![](/assets/image-20190817-005818.47386a6b5f18be7aba01eaa7dfd69765c3c421ea75e84a5e2004e5debc278637.cf3845cb.png) 1. Select Add Values. 2. List all Treasure Data segment IDs, line-by-line. For example, 257, 258, 259. ![](/assets/image-20190817-005915.1e9c6c7dbf16602d95d6248f7891e7a0d52ea4ab6d3a656320430d6d7c29491f.cf3845cb.png) 1. Select Apply. 2. Optionally, add Display name to specific segment IDs. ![](/assets/image-20190817-010000.34f47caab6ff96b4c23acceef14349d2b83dc28c006960bc2d3ed585735e4263.cf3845cb.png) 1. Select **Inventory** > **Ad units**. 2. Select Ad Unit. 3. Complete the Code and Name fields. ![](/assets/image-20190817-010148.7813a892ab085eda685d31b6eaa986e2ee70563add103d2af256a5d16ed7a925.cf3845cb.png) 1. Select Save. 2. Select Delivery > Orders. 3. Select New Order to create a new order. ![](/assets/image-20190817-010418.dd6184319971de6160b9f1bd3e1a172f8481832223dc44d1d1f46ccfb0023363.cf3845cb.png) 1. Edit the fields. For example, Name, Advertiser, Start time, End time, Quantity, and Rate. ![](/assets/image-20190817-010509.30703d5f0a3c29b020335f94a845d2c7aee61202cda51e19a85543b2a6fbff52.cf3845cb.png) 1. Scroll down to locate the Key-values section. 2. Specify the Key-value that you created. For example, td_kv_wp. ![](/assets/image-20190817-010551.c63e2dc0750e6c64133a436e5f7398a84b706d9596adaf3102b12ecc815f98c6.cf3845cb.png) 1. Select the list of Segment IDS that you created. For example: ![](/assets/image-20190817-010637.6b9f71e14a56400e8a4479389b1823ab6cc45a0934af15b6c4d0d4a4d9672c8e.cf3845cb.png) 1. Select Inventory. 2. Select the advertisement unit that you created. For example, td-dfp-test-ad. An order object is created. For example: ![](/assets/image-20190817-010727.db4a563ca99cc444be07e8ec62ba752f631472c9610bc84c5f5661e4ec0f0557.cf3845cb.png) 1. Navigate to Delivery > Line items to register the creatives. 2. Select Add Creatives. ![](/assets/image-20190817-010829.2bd49e3936f50d4b9779bbe0bdfbded30e260a0c94484b7a818d0e11fcb415a7.cf3845cb.png) 1. Select the creative type you'd like to create. For example, an image creative. ![](/assets/image-20190817-010915.c175a1bf871cd9d93255f50dfeb722878c4814b4ae105dff5635d1e8d226affa.cf3845cb.png) 1. Specify the Name and Destination. 2. Upload an image file for the creative. 3. Specify a Destination. For example, https://www.treasuredata.com/. ![](/assets/image-20191204-022437.44adf1069dd7bbe5307f06fc5bff8d42bc39dbdf04d6425bff485a8806ba0096.cf3845cb.png) ## Create JavaScript DFP and Treasure Data Tags To generate Google DFP’s JavaScript tag: 1. In your web browser, navigate to Google DFP. 2. Navigate to Inventory > Ad units. 3. Select Generate Tags. 4. Select the advertising units that you created. For example, td-dfp-test-ad. ![](/assets/image-20190817-011046.27d2ee6034adbc0fd6bde98673dafa8f18413424e92946eb779581b9140b2809.cf3845cb.png) 1. Select the Google Publisher Tag as the Tag Type. ![](/assets/image-20190817-011142.727e1f8bc6d676624dc1e1d465236ca05364172fc0d14b1be75266b4de9bb595.cf3845cb.png) 1. Select Continue. A JavaScript tag is generated for the HTML header and body. ![](/assets/image-20191209-221112.81199d3a270674952c0267b946f3465606f1541dc2e8efbb7b6efd2f6db374b4.cf3845cb.png) 1. Save your work. **To combine the DFP tag and your Treasure Data JavaScript tag:** 1. Open the file where you want to combine your Treasure Data JavaScript and DFP tags. 2. Call googletag.pubads().setTargeting() function to pass Treasure Data’s segment IDs to Google DFP. For example, the following HTML contains the integration code between DFP JavaScript Tag and TD JavaScript Tag. ```html Web Profiles API Hello Treasure Data!
``` To test, access the HTML above, and review the result. ![](/assets/image-20191204-022522.638a506e9fb9031144c9f8d5ceeb325c05a08c460d82e5b2e2b31d3e79f0afd8.cf3845cb.png)