# The Trade Desk CRM Data Integration You can write job results from Treasure Data directly to The Trade Desk. In The Trade Desk, you can then use these Data Export in your ad campain. ## Prerequisites - Basic knowledge of Treasure Data, including the [TD Toolbelt](https://toolbelt.treasuredata.com/) - An account in The Trade Desk. - Authorized Treasure Data account access. ## Connector Usecase - **Advertiser First-Party Data API by The Trade Desk Export connector** - What it is: A more permanent integration that syncs an advertiser’s customer database with The Trade Desk. - How it’s used: Strategic, always-on use of first-party data as an asset. For example, continuously syncing loyalty program members into the platform so they can be used across many campaigns over time. - Business value: Turns your customer base into a long-term strategic asset for advertising. Instead of campaign-by-campaign uploads, your data is always available to fuel audience creation and targeting. - **CRM Data Integration API by The Trade Desk CRM Data Export connector** - What it is: A way to upload specific customer lists (emails, phone numbers, etc.) into the platform to build a segment. - How it’s used: Typically for campaign-specific or one-off use cases. For example, uploading a list of churned customers to exclude them from an upcoming campaign. - Business value: Gives marketers the flexibility to act quickly — “I want to target or exclude this group right now.” ## Using the TD Console to Create Your Connection You can use the TD Console to configure your connection. ### In The Trade Desk: Getting the Platform API Token Go to **Manage API Tokens/Keys** and create a new token/keys or select existing tokens ![](/assets/screenshot-2025-08-25-at-16.08.28.826f922815daffd0a238a54074173595d4dd50c760776792ca9c871d2baa2848.2291c8f6.png) ### In Treasure Data: Creating a New Connection 1. From TD Console, select **Integrations Hub**. 2. Select **Catalog.** 3. Search for and select T**he Trade Desk CRM Data** Output connector. ![](/assets/screenshot-2025-09-11-at-10.49.38.c42564b93edfbcdf87b942f85d27839dea9bdfb263a2e3e08f36bb007f3b9470.95f75723.png) 4. Select **Create Authentication**. The New Authentication dialog opens. ![](/assets/screenshot-2025-09-11-at-10.56.53.0826487fd581434fe6b86f1c2019f6022364e528aba0b4bbca22156c9bec8793.95f75723.png) 5. Edit the CRM Data Token and advertiser ID you obtained from The Trade Desk, and select **Continue**. 6. Enter a name for the connection. ![](/assets/tradedesknewauthb.1c83a3cb0dcb352f1b606312d0876c7ef00c89eb9f6f015a6d45062a4b51db64.7f5c9654.png) 7. Select **Done**. The Trade Desk output connector is created. ### Configuring Export Results in Your Data Connection In this step, you create or reuse a query. In the query, you configure the data connection.  In some cases, you must define the column mapping in the query. ### Configuring the Connection by Specifying the Parameters 1. Access the TD Console and navigate to **Data Workbench > Queries**. 2. Locate and select the the query that you want to use to export data. 3. Select **Export Results** located at top of your query editor. The Choose Integration dialog displays. 4. Enter The Trade Desk connection name in the search box to filter and select your connection. 5. Specify the parameters: **Parameters**: - **CRM Data Segment ID**(optional): Your CRM Data Segment ID. Required if **Segment Name** is empty. - **Segment Name**(optional): Your segment name. Required if **CRM Data Segment ID** is empty. - **Merge Mode** (required): The way the newly uploaded personally identifiable information (PII) is to be merged with the existing data. One of **Add**, **Replace**. Default is **Add** - **PII Type** (required): The type of personally identifiable data (PII) sent by the advertiser. Select from a drop down, see [PII Types](/int/the-trade-desk-crm-data-integration#h3_74552168). Default is **Email**. - **Time-to-Live (TTL)**(optional): Time-to-live in minutes for the anonymized identifiers generated by the mapping process. Default is 129.600 (90 days). - **Wait Until Finished** (optional): Check to let the job execution wait until drop state move to final. Default is false (unchecked). - **Max Wait Time** (optional): Max time until jobs finished in minutes. Default is 720 minutes (12 hours). Allow value range 0 - 1380 (23 hours). - **Skip invalid record(s)** (optional): Check to skip invalid records and process all remaining. Default is true (checked) ### PII Type | Pii Type | Description | | --- | --- | | Email | PII sent as email addresses. | | EmailHashedUnifiedId2 | PII sent as normalized, SHA-256-hashed, base64-encoded email addresses, ready for conversion to UID2. | | Phone | PII sent as phone numbers. | | PhoneHashed | PII sent as normalized, SHA-256-hashed, base64-encoded phone number | | UID2 | The raw UID2 value, also known as UID2. This value is case-sensitive. Raw UID2s are generated and managed using UID2 APIs. | | UID2Token | The encrypted UID2 token, also known as an advertising token. This token is case-sensitive. Tokens are generated and managed using UID2 APIs. For details about UID2 APIs, see UID2 Endpoints. For details about UID2 tokens, see Raw IDs vs. Tokens. | | EUID | The raw European Unified ID value, also known as EUID. This value is case-sensitive. EUID offers user transparency and privacy controls designed to meet market requirements in European regions with the same normalization and encoding of PII as UID2. | | EUIDToken | The encrypted EUID token, also known as an advertising token. This token is case-sensitive. For details, see Unified IDs. | | IDL | The 49-character or 70-character RampID (previously known as IdentityLink) | | ID5 | The ID5 for the user. Data providers holding these IDs should engage with ID5 directly to obtain the necessary decryption keys. For details about ID5, see the ID5 site. **IMPORTANT**: The ID5 ID is supported only in Europe and must be in decrypted form. | | NetID | The user's netID as a 70-character base64-encoded string. For details about netID, see the netID Developer Portal. **IMPORTANT**: This ID is supported only in Europe. | | FirstId | The user's First-id, a first-party cookie typically set by publishers in France. For details about First-id, see the First-id site. **IMPORTANT**: This ID is supported only in Europe. | | TDID | The Trade Desk 36-character GUID (including dashes) for this user. | | DAID | The raw device ID for this user, sent in 36-character GUID format (including dashes). Use iOS IDFA or Android's AAID. | ### A sample configuration is as follows: ![](/assets/screenshot-2025-08-25-at-14.47.02.de7ab4505b6641b0a8a5ba4d0f2da5888dbb88f7cbfed514ebe4e982818c9e34.2291c8f6.png) ### Data Validation - **PII** columns must not be empty. - **Timestamp_utc** must not be empty. Column type can be string in datetime format or long for datetime in seconds. ### Example Queries to Populate The Trade Desk From Treasure Data, run the following query with Output results into a connection for The Trade Desk: **Example Query** ```sql SELECT PII, timestamp_utc, VALUE, value_currency, Country, Region, metro, City, OrderId, td_1, td_2, td_3, privacy_type, is_applicable, consent_string FROM ( VALUES ('', '2025-08-11 03:25:25.675', 4.5, 'USD', 'US', 'Region', 56, 'City', 'order id', 'custom data 1', 'custom data 2', 'custom data 3', 'GPP', TRUE, 'consent string'), ('customer1@example.org', '2025-08-11 03:25:25.675', 4.5, 'USD', 'US', 'Region', 56, 'City', 'order id', 'custom data 1', 'custom data 2', 'custom data 3', 'GPP', TRUE, 'consent string'), ('customer2@example.org', NULL, 4.5, 'USD', 'US', 'Region', 56, 'City', 'order id', 'custom data 1', 'custom data 2', 'custom data 3', 'GPP', TRUE, 'consent string'), ('customer3@example.org', '2025-08-11 03:25:25.675', 4.5, 'USD', 'US', 'Region', 56, 'City', 'order id', 'custom data 1', 'custom data 2', 'custom data 3', 'GPP', FALSE, 'consent string') ) AS tbl ( PII, timestamp_utc, VALUE, value_currency, Country, Region, metro, City, OrderId, td_1, td_2, td_3, privacy_type, is_applicable, consent_string ); ``` ### (Optional) Schedule Query Export Jobs You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify. Treasure Data's scheduler feature supports periodic query execution to achieve high availability. When two specifications provide conflicting schedule specifications, the specification requesting to execute more often is followed while the other schedule specification is ignored. For example, if the cron schedule is `'0 0 1 * 1'`, then the 'day of month' specification and 'day of week' are discordant because the former specification requires it to run every first day of each month at midnight (00:00), while the latter specification requires it to run every Monday at midnight (00:00). The latter specification is followed. #### Scheduling your Job Using TD Console 1. Navigate to **Data Workbench > Queries** 2. Create a new query or select an existing query. 3. Next to **Schedule**, select None. ![](/assets/image2021-1-15_17-28-51.f1b242f6ecc7666a0097fdf37edd1682786ec11ef80eff68c66f091bc405c371.0f87d8d4.png) 4. In the drop-down, select one of the following schedule options: ![](/assets/image2021-1-15_17-29-47.45289a1c99256f125f4d887e501e204ed61f02223fde0927af5f425a89ace0c0.0f87d8d4.png) | Drop-down Value | Description | | --- | --- | | Custom cron... | Review [Custom cron... details](#custom-cron-details). | | @daily (midnight) | Run once a day at midnight (00:00 am) in the specified time zone. | | @hourly (:00) | Run every hour at 00 minutes. | | None | No schedule. | #### Custom cron... Details ![](/assets/image2021-1-15_17-30-23.0f94a8aa5f75ea03e3fec0c25b0640cd59ee48d1804a83701e5f2372deae466c.0f87d8d4.png) | **Cron Value** | **Description** | | --- | --- | | `0 * * * *` | Run once an hour. | | `0 0 * * *` | Run once a day at midnight. | | `0 0 1 * *` | Run once a month at midnight on the morning of the first day of the month. | | "" | Create a job that has no scheduled run time. | ``` * * * * * - - - - - | | | | | | | | | +----- day of week (0 - 6) (Sunday=0) | | | +---------- month (1 - 12) | | +--------------- day of month (1 - 31) | +-------------------- hour (0 - 23) +------------------------- min (0 - 59) ``` The following named entries can be used: - Day of Week: sun, mon, tue, wed, thu, fri, sat. - Month: jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec. A single space is required between each field. The values for each field can be composed of: | Field Value | Example | Example Description | | --- | --- | --- | | A single value, within the limits displayed above for each field. | | | | A wildcard `'*'` to indicate no restriction based on the field. | `'0 0 1 * *'` | Configures the schedule to run at midnight (00:00) on the first day of each month. | | A range `'2-5'`, indicating the range of accepted values for the field. | `'0 0 1-10 * *'` | Configures the schedule to run at midnight (00:00) on the first 10 days of each month. | | A list of comma-separated values `'2,3,4,5'`, indicating the list of accepted values for the field. | `0 0 1,11,21 * *'` | Configures the schedule to run at midnight (00:00) every 1st, 11th, and 21st day of each month. | | A periodicity indicator `'*/5'` to express how often based on the field's valid range of values a schedule is allowed to run. | `'30 */2 1 * *'` | Configures the schedule to run on the 1st of every month, every 2 hours starting at 00:30. `'0 0 */5 * *'` configures the schedule to run at midnight (00:00) every 5 days starting on the 5th of each month. | | A comma-separated list of any of the above except the `'*'` wildcard is also supported `'2,*/5,8-10'`. | `'0 0 5,*/10,25 * *'` | Configures the schedule to run at midnight (00:00) every 5th, 10th, 20th, and 25th day of each month. | 1. (Optional) You can delay the start time of a query by enabling the Delay execution. ### Execute the Query Save the query with a name and run, or just run the query. Upon successful completion of the query, the query result is automatically exported to the specified destination. Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications. (Optional) You can delay the start time of a query by enabling the Delay execution. ## Activate a Segment in Audience Studio You can also send segment data to the target platform by creating an activation in the Audience Studio. 1. Navigate to **Audience Studio**. 2. Select a parent segment. 3. Open the target segment, right-mouse click, and then select **Create Activation.** 4. In the **Details** panel, enter an Activation name and configure the activation according to the previous section on Configuration Parameters. 5. Customize the activation output in the **Output Mapping** panel. ![](/assets/ouput.b2c7f1d909c4f98ed10f5300df858a4b19f71a3b0834df952f5fb24018a5ea78.8ebdf569.png) - Attribute Columns - Select **Export All Columns** to export all columns without making any changes. - Select **+ Add Columns** to add specific columns for the export. The Output Column Name pre-populates with the same Source column name. You can update the Output Column Name. Continue to select **+ Add Columns**to add new columns for your activation output. - String Builder - **+ Add string** to create strings for export. Select from the following values: - String: Choose any value; use text to create a custom value. - Timestamp: The date and time of the export. - Segment Id: The segment ID number. - Segment Name: The segment name. - Audience Id: The parent segment number. 1. Set a **Schedule**. ![](/assets/snippet-output-connector-on-audience-studio-2024-08-28.a99525173709da1eb537f839019fa7876ffae95045154c8f2941b030022f792c.8ebdf569.png) - Select the values to define your schedule and optionally include email notifications. 1. Select **Create**. If you need to create an activation for a batch journey, review [Creating a Batch Journey Activation](/products/customer-data-platform/journey-orchestration/batch/creating-a-batch-journey-activation). ## Using TD Toolbelt and Your The Trade Desk Connection You can use TD Toolbelt from the CLI to export to The Trade Desk. Example ```bash td query \ -d [database] \ -q "SELECT * FROM offline_conversion" \ --type presto \ --result '{ "type": "thetradedesk_crm_data", "crm_api_token": "xxx", "advertiser_id": "xxx", "crm_data_id": "xxx", "skip_invalid_records": true }' ``` ## Configuring Export Results in Workflow (Optional) Within Treasure Workflow, you can specify the use of this data connector to output data. ```yaml timezone: UTC _export: td: database: sample_datasets +td-result-into-target: td>: queries/sample.sql result_connection: your_connections_name result_settings: crm_api_token: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx advertiser_id: xxxxxx crm_data_id: xxx .... ``` Review [information on using data connectors in workflow](https://docs.treasuredata.com/smart/project-product-documentation/using-integrations-to-import-data-with-td-workflows) to export data. ## Appendix ### Statistic logs Statistic logs for skipping records and upload detail from The Trade Desk are shown at the end of job execution. ### Sample skipping records from plugin validation ``` 2025-08-25 08:02:35.717 +0000 [INFO] (0001:transaction): ************* REPORT *************2025-08-25 08:02:35.717 +0000 [INFO] (0001:transaction): Total records: 42025-08-25 08:02:35.717 +0000 [INFO] (0001:transaction): Uploaded records: 12025-08-25 08:02:35.717 +0000 [INFO] (0001:transaction): Total skipped records: 32025-08-25 08:02:35.721 +0000 [WARN] (0001:transaction): Data error - Skip processing the record index [0]: The required field(s) is(are) null or empty: pii2025-08-25 08:02:35.721 +0000 [WARN] (0001:transaction): Data error - Skip processing the record index [2]: The required field(s) is(are) null or empty: timestamp_utc2025-08-25 08:02:35.721 +0000 [WARN] (0001:transaction): Data error - Skip processing the record index [3]: The required field(s) is(are) null or empty: timestamp_utc ``` ### Sample The Trade Desk statistic logs ``` 2025-08-25 08:02:35.712 +0000 [WARN] (0025:task-0000): =========== UPLOAD STATISTIC FROM TTD ===========2025-08-25 08:02:35.712 +0000 [WARN] (0025:task-0000): ===== Total Records: 12025-08-25 08:02:35.712 +0000 [WARN] (0025:task-0000): ===== Valid Records: 12025-08-25 08:02:35.713 +0000 [WARN] (0025:task-0000): ===== Succeeded Records: 12025-08-25 08:02:35.713 +0000 [WARN] (0025:task-0000): ===== Failed Records: 02025-08-25 08:02:35.713 +0000 [WARN] (0025:task-0000): ===== Empty Records: 02025-08-25 08:02:35.713 +0000 [WARN] (0025:task-0000): ===== Ingested Records: 12025-08-25 08:02:35.713 +0000 [WARN] (0025:task-0000): ================================================= ``` ## See Also - [Scheduling Data Connector Job Execution from the CLI](/int/scheduling-a-data-connector-job-execution-from-the-cli)