The Trade Desk connector for Snowflake: First-party segments

Advertisers and data providers can use The Trade Desk connector native app to upload first-party audience data to The Trade Desk using Snowflake. The Trade Desk connector native app helps streamline data integration with The Trade Desk and includes support for UID2 mapping from email addresses and phone numbers. It provides a flexible, guided, and secure setup experience that works across all Snowflake-supported environments and a variety of advertising use cases.

Audience segment upload processing is designed for volume and performance at scale. It works by processing records that you populate into the input table. To transfer data to The Trade Desk DSP for your use, the native app performs the following actions:

To see how to send your first-party audience data from Snowflake to The Trade Desk, watch the first-party data demo video.

What you need to know

Here's what you need to know about preparing your audience segment data for processing:

Here's what you need to know about processing the segments:

Snowflake marketplace listing

The following listing from The Trade Desk for processing audience data in Snowflake is available in the Snowflake marketplace:

Complete setup steps

Before processing the data, you must complete all the steps covered in The Trade Desk connector for Snowflake: Get started, including the following setup tasks:

For details, see Configure the native app.

Upload format for endpoint

The data you upload to The Trade Desk connector native app must be in a format consumable by an endpoint from The Trade Desk. Make sure your data is in the correct format for the applicable endpoint shown in the following table.

For specific data requirements, see SQL objects.

Role Endpoint
Advertiser POST /data/advertiser
Data Provider POST /data/advertiser (External Provider)

Process data

Processing of new or changed audience segments starts in one of these ways:

TIP: When you're processing data for the first time, we recommend using a small amount of data, such as 100 IDs. On a smaller dataset it's easier to make sure that processing goes smoothly, and to troubleshoot if needed. When you've confirmed that everything is working smoothly for this small amount, you can process large volumes of data.

To process segments in the Snowflake Native App UI, follow these steps:

  1. Copy data from your own database into the input table, transforming the data as needed to meet the formatting requirements. For details, see SQL objects.
  2. On the Segments page, click Refresh to check that the data has been added in the Unprocessed Counts field and that the counts are accurate.
  3. Click Process Immediately. This triggers execution.
  4. Check that your new counts are displayed in the Successful field.

Verify data processing

There are several ways you can verify that your data was processed correctly:

Reference information

The following sections provide reference information for using this connector, such as supported ID types, tables and views, stored procedures, and example commands.

Segments page

The Segments page shows dimensions of your segments information, along with some simple controls to manage execution. The table schema was created during configuration (see Configure the native app), and includes fields for the data elements (see SQL objects).

The following summary information is at the top of the page:

IMPORTANT: For information about the expected format of the data, see Upload format for endpoint. The field names might not be identical.

The following table lists the buttons on the Segments page and what they do.

Button Function
Process immediately Checks the input table for items that haven't been processed yet, and immediately submits them to the authorized URL for processing, per the External Integration Binding permission (see Native app permissions).
Start task Starts a task that checks the input table for changes and submits new changes regularly to the authorized URL for processing, per the External Integration Binding permission (see Native app permissions).
Stop task
(Only present when a task is running)
Stops the current process from running. You could use this, for example, if you're getting errors and you want to stop and try to fix the problem.
Refresh Refreshes the page in The Trade Desk connector native app. This button refreshes only the UI; it does not affect the processing of data. It refreshes values displayed, such as the number of segment IDs processed.

Supported ID types

The Trade Desk connector native app supports a subset of the ID types supported by The Trade Desk external provider first-party data endpoint (see Upload format for endpoint), as well as additional ID types to support the processing of UID2s. The following table lists all supported ID types.

IMPORTANT: Only the ID types listed in this table are supported. The following ID types require UID2 signed paperwork and the associated additional permissions: UID2, UID2Token, email, phone, email_hash, and phone_hash.

ID Type Data Type Description
TDID GUID The Trade Desk 36-character GUID (including dashes) for this user.
DAID GUID The raw device ID for this user, sent in 36-character GUID format (including dashes). Use the iOS ID for advertisers (IDFA) or Android advertising ID (AAID).
UID2 String The raw UID2 value, also known as UID2. This value is case-sensitive. Raw UID2s are generated and managed using UID2 APIs. See also Unified IDs.
UID2Token String 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: Summary. For details about UID2 tokens, see Raw IDs vs. tokens.
RampID String The 49-character or 70-character RampID (previously known as IdentityLink).
IMPORTANT: This must be a RampID from LiveRamp that is mapped specifically for The Trade Desk. For details about mapping a RampID, see LiveRamp documentation.
ID5 String 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 String The user's netID as a 70-character Base64-encoded string. For details about netID, see the netID Developer Zone.
IMPORTANT: This ID is supported only in Europe.
FirstId String 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.
email String A raw email address for conversion to a UID2. The native app normalizes and hashes the email address before sending the data to The Trade Desk. It never sends raw email addresses outside your Snowflake account.
phone String A raw phone number for conversion to a UID2. The native app normalizes and hashes the phone number before sending the data to The Trade Desk. It never sends raw phone numbers outside your Snowflake account.
email_hash String A hashed email address for conversion to a UID2. For requirements, see Email address hashing and encoding.
phone_hash String A hashed phone number for conversion to a UID2. For requirements, see Phone number hashing and encoding.

SQL objects

The Trade Desk connector native app creates a data table, INPUT.AUDIENCE_SEGMENT, for the segments data.

IMPORTANT: It's important to understand how the base bid CPM and bid factor work together, and how they can affect campaign budgets. If you intend to use base bid CPM or bid factoring, and haven't used them before, ask your Technical Account Manager for guidance.

The following table lists the column names, in sequence.

NOTE: The uploaded data must be in a format consumable by the applicable data endpoint from The Trade Desk: see Upload format for endpoint. Fields that occur in the API are defined in detail in the linked endpoint documentation.

Column Name SQL Data Type Notes
RECORD_ID INT A unique ID assigned to the record. Each time a new row is added, the value increases.
ID_TYPE VARCHAR Supports any one of the user ID types listed in Supported ID types.
ID_VALUE VARCHAR Supports the value for any one of the user ID types listed in Supported ID types: for example, ID_TYPE of email and ID_VALUE of user123@example.com. For an example with multiple IDs, see Insert multiple user IDs for an audience segment.
SEGMENT_NAME VARCHAR See Data object in the POST /data/advertiser (External Provider) endpoint documentation.
TTL_IN_MINUTES INT See Data object in the POST /data/advertiser (External Provider) endpoint documentation.
TIMESTAMP_UTC TIMESTAMP_NTZ See Data object in the POST /data/advertiser (External Provider) endpoint documentation. For usage, see FAQs.
BASE_BID_CPM FLOAT See Data object in the POST /data/advertiser (External Provider) endpoint documentation.
BID_FACTOR FLOAT See Data object in the POST /data/advertiser (External Provider) endpoint documentation.
ADVERTISER_ID VARCHAR Your ID, assigned to you by The Trade Desk.
LAST_UPDATED_ON_UTC TIMESTAMP_NTZ An optional value that triggers re-processing of the record. For usage, see FAQs.

Tables and views

For first-party user optouts, The Trade Desk connector native app exposes the database objects shown in the following table.

Table/View Name Notes
Table INPUT.AUDIENCE_SEGMENT Populate this table with segments that you want to upload for processing.
View APP.VW_AUDIENCE_SEGMENT_RESULT Shows one entry, the latest, when entries on the INPUT.AUDIENCE_SEGMENT table are processed.
View APP.VW_AUDIENCE_SEGMENT_RESULT_LOG If an existing row on the INPUT.AUDIENCE_SEGMENT table is updated, each version is a separate row in the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG view. This shows history.
For example, if an input row is changed once, it appears once in the APP.VW_AUDIENCE_SEGMENT_RESULT view and twice in the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG view.

When processing segments, the native app performs these steps:

  1. Checks authorization and validation.
  2. Uploads the records from the INPUT.AUDIENCE_SEGMENT table to The Trade Desk.
  3. Adds a result that appears in the APP.VW_AUDIENCE_SEGMENT_RESULT view with the same RECORD_ID value as in the INPUT.AUDIENCE_SEGMENT record.

Sample input view

The following table shows a sample of first-party audience data in the INPUT.AUDIENCE_SEGMENT table.

NOTE: The table includes the following columns: RECORD_ID, ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID, LAST_UPDATED_ON_UTC. Because of the width, depending on your screen resolution, the table might wrap.

+-----------+------------+----------------------------------------------+------------------------+----------------+---------------+--------------+------------+---------------+-------------------------+
| RECORD_ID | ID_TYPE    | ID_VALUE                                     | SEGMENT_NAME           | TTL_IN_MINUTES |TIMESTAMP_UTC  | BASE_BID_CPM | BID_FACTOR | ADVERTISER_ID | LAST_UPDATED_ON_UTC     |
+-----------+------------+----------------------------------------------+------------------------+----------------+---------------+--------------+------------+---------------+-------------------------+
| 202       | TDID       | 47d4fc00-9eab-4880-93b2-8bf473ecf729         | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 203       | UID2       | tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 204       | DAID       | 47d4fc00-9eab-4880-93b2-8bf473ecf729         | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 205       | RampID     | 47d4fc00-9eab-4880-93b2-8bf473ecf729         | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 206       | ID5        | 47d4fc00-9eab-4880-93b2-8bf473ecf729         | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 207       | netID      | 47d4fc00-9eab-4880-93b2-8bf473ecf729         | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 208       | FirstId    | 47d4fc00-9eab-4880-93b2-8bf473ecf729         | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 209       | email      | user4554@example.com                         | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 210       | email_hash | tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ= | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 211       | phone      | 1234567890                                   | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 212       | phone_hash | EObwtHBUqDNZR33LNSMdtt5cafsYFuGmuY4ZLenlue4= | native_app_seg_11.3.25 | 91234          |               |              |            | 00aa92d       | 2025-11-03 19:38:40.299 |
| 213       | TDID       | 1364cfc8-8850-4fe4-93f2-8728ed4d0b2d         | native_app_seg_11.9.25 | 43200          |               | 1            | 1          | 00aa92d       | 2025-11-03 19:38:40.299 |
| 214       | TDID       | 1889c638-af7c-4d35-82b6-8746f9a4bb15         | native_app_seg_11.9.25 | 43200          |               | 1            | 1          | 00aa92d       | 2025-11-03 19:38:40.299 |
+-----------+------------+----------------------------------------------+------------------------+----------------+---------------+--------------+------------+---------------+-------------------------+

Results view

The following table shows sample results in the APP.VW_AUDIENCE_SEGMENT_RESULT view.

NOTE: The table includes the following columns: LOG_ID, RECORD_ID, ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID, LAST_UPDATED_ON_UTC, PROCESSED_ON_UTC, IS_DELETE, IS_SUCCESS, ERROR_CODE, ERROR_MESSAGE, IS_DUPLICATE. Because of the width, depending on your screen resolution, the table might wrap.

+--------+-----------+------------------------------------------------+---------------------+----------------+---------------+--------------+------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+--------------+
| LOG_ID | RECORD_ID | ID_TYPE | ID_VALUE                             | SEGMENT_NAME        | TTL_IN_MINUTES | TIMESTAMP_UTC | BASE_BID_CPM | BID_FACTOR | ADVERTISER_ID | LAST_UPDATED_ON_UTC     | PROCESSED_ON_UTC        | IS_DELETE | IS_SUCCESS | ERROR_CODE | ERROR_MESSAGE | IS_DUPLICATE |
+--------+-----------+------------------------------------------------+---------------------+----------------+---------------+--------------+------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+--------------+
| 201    | 202       | TDID    | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg      | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 202    | 203       | DAID    | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg      | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 203    | 204       | RampID  | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg      | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 204    | 205       | ID5     | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg      | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 205    | 206       | netID   | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg      | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 206    | 207       | FirstId | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg      | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 207    | 201       | TDID    | 47d4fc00-9eab-4880-93b2-8bf473ecf729 | native_app_seg      | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 101    | 101       | TDID    | 1364cfc8-8850-4fe4-93f2-8728ed4d0b2d | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 102    | 102       | TDID    | 1889c638-af7c-4d35-82b6-8746f9a4bb15 | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
| 103    | 103       | TDID    | fd25b103-fd1f-48ce-9aef-512d6636982a | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               | FALSE        |
+--------+-----------+------------------------------------------------+---------------------+----------------+---------------+--------------+------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+--------------+

The following table shows sample results in the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG view.

NOTE: The table includes the following columns: LOG_ID, RECORD_ID, ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID, LAST_UPDATED_ON_UTC, PROCESSED_ON_UTC, IS_DELETE, IS_SUCCESS, ERROR_CODE, ERROR_MESSAGE. Because of the width, depending on your screen resolution, the table might wrap.

+--------+-----------+---------+--------------------------------------+---------------------+----------------+---------------+--------------+------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+
| LOG_ID | RECORD_ID | ID_TYPE | ID_VALUE                             | SEGMENT_NAME        | TTL_IN_MINUTES | TIMESTAMP_UTC | BASE_BID_CPM | BID_FACTOR | ADVERTISER_ID | LAST_UPDATED_ON_UTC     | PROCESSED_ON_UTC        | IS_DELETE | IS_SUCCESS | ERROR_CODE | ERROR_MESSAGE |
+--------+-----------+---------+--------------------------------------+---------------------+----------------+---------------+--------------+------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+
| 15     | 15        | TDID    | 59ee8049-988a-5df1-8575-0e1ee88eff1f | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 63     | 63        | TDID    | 8e3d1da7-0275-495d-b48e-6a283fb2a2ec | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 4      | 4         | TDID    | 1e2ebb25-f8b7-4e28-85f1-f6a9597e3ad5 | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 40     | 40        | TDID    | 2126d866-641d-4ba7-9e5c-8cf35ecf8b01 | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 108    | 108       | TDID    | f3a1175c-c225-41cb-8c09-bda280c2ff25 | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 115    | 115       | TDID    | 59ee8049-988a-5df1-8575-0e1ee88eff1f | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 174    | 174       | TDID    | 1ba6d0b6-4a59-44b9-af44-812729a3fc4f | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 75     | 75        | TDID    | 39f09669-d3c3-4ec8-88c7-5c6cbc7502d1 | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 172    | 172       | TDID    | c3ec5f4f-47b1-40b1-9752-c069e4f50325 | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
| 7      | 7         | TDID    | 3fb35bcb-c7c7-4c71-84d5-c8e0d44928c0 | native_app_seg_2025 | 91234          |               |              |            | l4xa9dz       | 2025-11-03 19:38:40.299 | 2025-11-04 20:38:40.299 | FALSE     | TRUE       |            |               |
+--------+-----------+---------+--------------------------------------+---------------------+----------------+---------------+--------------+------------+---------------+-------------------------+-------------------------+-----------+------------+------------+---------------+

Stored procedures

For processing first-party audience segments, the native app provides several stored procedures. Follow these key guidelines:

IMPORTANT: Violating these guidelines could lead to conflicts or inconsistent data.

The following table summarizes each procedure, its UI equivalent, and what it does.

Procedure UI Equivalent Description
APP.SP_PROCESS_SEGMENTS(BATCH_SIZE INT, STOP_AFTER_SECONDS INT) Select Process Immediately. Processes BATCH_SIZE records in the INPUT.AUDIENCE_SEGMENT table immediately. After processing a batch, the procedure checks whether the STOP_AFTER_SECONDS value has elapsed, and does one of the following:
  • If the value has elapsed, the procedure completes.
  • If the value has not elapsed, the procedure loops and processes another batch.
If any rows remain unprocessed when the procedure is complete, call APP.SP_PROCESS_SEGMENTS(BATCH_SIZE INT, STOP_AFTER_SECONDS INT) again until all rows are processed. For details, see Process unprocessed first-party audience segment records.
APP.SP_PRUNE_AUDIENCE_SEGMENT_RESULT_LOG(PRUNE_ERROR_LOGS BOOLEAN DEFAULT FALSE) None Deletes historical result logs from the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG view. If the PRUNE_ERROR_LOGS property is FALSE, historical error results remain. If the PRUNE_ERROR_LOGS property is set to TRUE, the results are the following:
  • Historical error results are deleted.
  • The data in the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG view is updated, and at that point it's the same data as in the APP.VW_AUDIENCE_SEGMENT_RESULT view.
  • The results remaining in the APP.VW_AUDIENCE_SEGMENT_RESULT_LOG view are all current values, corresponding to the rows in INPUT.AUDIENCE_SEGMENT.
APP.SP_START_SEGMENT_TASK(); Select Start Task. Starts a task that runs the APP.SP_PROCESS_SEGMENTS(BATCH_SIZE INT, STOP_AFTER_SECONDS INT) stored procedure whenever there are changes to the input table. The task is executed by the warehouse specified in the Permissions step of the app configuration.
APP.SP_STOP_SEGMENT_TASK(); Select Stop Task. Stops the task that runs the APP.SP_PROCESS_SEGMENTS(BATCH_SIZE INT, STOP_AFTER_SECONDS INT) stored procedure whenever there are changes to the input table, if the task is running.
APP.SP_GET_SEGMENT_TASK_STATE(); View Task State. Returns a value indicating whether the segment task is running.
APP.SP_FORCE_RESET_SEGMENT_PIPELINE() None Forces a reset, clearing the ingestion pipeline state. For details, see Using the force reset procedure.
IMPORTANT: Use only as a last resort.

Using the force reset procedure

The APP.SP_FORCE_RESET_SEGMENT_PIPELINE() stored procedure is a last-resort fix that clears out the ingestion pipeline state.

IMPORTANT: Use this only in scenarios where the pipeline is stuck and cannot make progress.

Here are some sample scenarios:

If you absolutely have to use this stored procedure, follow these steps.

IMPORTANT: Any rows that were present before executing this stored procedure, in the input table or the pipeline, will not be picked up for processing afterwards. After running the stored procedure, only newly inserted rows are picked up for processing.

  1. If there's any data in the input table that hasn't yet been processed, or is invalid or problematic, remove it.
  2. Run the APP.SP_FORCE_RESET_SEGMENT_PIPELINE() stored procedure.
  3. Insert new data into the INPUT.AUDIENCE_SEGMENT table for processing, or update the LAST_UPDATED_ON_UTC column for existing data, after verifying that the data is not invalid or malformed.

Error messages

If you're processing first-party audience segments, you might see one or more of the error messages shown in the following table.

Error Code Error Message
EmailOrPhoneNotAllowed The selected partner is not allowed to push email and phone data
UID2NotAllowed The selected partner is not allowed to push UID2 data
EUIDNotAllowed The selected partner is not allowed to push EUID data
Uid2Error Invalid identifier
Unknown Data name should not be empty
AdvertiserNotAllowed You do not have permission to advertiser: ADVERTISER_ID
MissingUserId One of the following:
  • Missing TDID DAID UID2 IDL CoreID ID5 NetID and FirstID
  • Invalid TDID
  • Invalid DAID
  • Invalid RampID
  • Invalid NetID
  • Invalid FirstID
  • Invalid ID5
  • Invalid UID2
  • Failed to decrypt UID2 Token.
InvalidUserId One of the following:
  • Invalid email address: bad email
    Action: Resolve the issue with the email and try again. For normalization details, see Email address normalization.
  • Phone number is not normalized: bad phone
    Action: Resolve the issue with the phone number and try again. For normalization details, see Phone number normalization.
HttpError HTTP error message

Example SQL commands

The following sample SQL commands show how to complete specific activities relating to audience segments, using this native app.

IMPORTANT: As an initial test, use only one row of data. This can help verify that the end-to-end flow is functioning correctly, or reveal areas that need adjustment, before processing large volumes of data.

Insert records for an audience segment

The following sample shows the SQL command syntax for inserting records for an audience segment.

insert into INPUT.AUDIENCE_SEGMENT (ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID) values 
    ('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER');

Replace the placeholders, SEGMENT_NAME_PLACEHOLDER and ADVERTISER_ID_PLACEHOLDER, with your own values. For example:

insert into INPUT.AUDIENCE_SEGMENT (ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID) values 
    ('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'native_app_seg_11.3.25', 91234, sysdate(), null, null, 'l8xa9dq');

Insert multiple user IDs for an audience segment

The following sample shows the SQL command syntax for including multiple user IDs in an audience segment.

insert into INPUT.AUDIENCE_SEGMENT (ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID) values 
    ('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('UID2', 'tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('DAID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('RampID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('ID5', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('FirstId', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('email', 'user4554@example.com', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('email_hash', 'tMmiiTI7IaAcPpQPFQ65uMVCWH8av9jw4cwf/F5HVRQ=', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('phone', '+1234567890', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER')
    ,('phone_hash', 'EObwtHBUqDNZR33LNSMdtt5cafsYFuGmuY4ZLenlue4=', 'SEGMENT_NAME_PLACEHOLDER', 91234, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER');

Replace the placeholders with your own values as shown in the previous example.

Process unprocessed first-party audience segment records

The following sample shows the SQL command syntax for processing unprocessed audience segment records. This example processes 1000 rows at a time in a loop, and stops looping if 180 seconds or more have elapsed.

call APP.SP_PROCESS_SEGMENTS(1000, 180);

Update segment records to extend TTL

The following sample shows the SQL command syntax for updating segment records to extend the TTL_IN_MINUTES value.

insert into INPUT.AUDIENCE_SEGMENT (ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID) values 
    ('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 259200, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER');

Replace the placeholders, SEGMENT_NAME_PLACEHOLDER and ADVERTISER_ID_PLACEHOLDER, with your own values. For example:

insert into INPUT.AUDIENCE_SEGMENT (ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID) values 
    ('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'native_app_seg_11.3.25', 259200, sysdate(), null, null, 'l8xa9dq');

Remove records from a segment

The following sample shows the SQL command syntax for removing records from a segment by setting the TTL_IN_MINUTES value to 0.

insert into INPUT.AUDIENCE_SEGMENT (ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID) values 
    ('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'SEGMENT_NAME_PLACEHOLDER', 0, sysdate(), null, null, 'ADVERTISER_ID_PLACEHOLDER');

Replace the placeholders, SEGMENT_NAME_PLACEHOLDER and ADVERTISER_ID_PLACEHOLDER, with your own values. For example:

insert into INPUT.AUDIENCE_SEGMENT (ID_TYPE, ID_VALUE, SEGMENT_NAME, TTL_IN_MINUTES, TIMESTAMP_UTC, BASE_BID_CPM, BID_FACTOR, ADVERTISER_ID) values 
    ('TDID', '47d4fc00-9eab-4880-93b2-8bf473ecf729', 'native_app_seg_11.3.25', 0, sysdate(), null, null, 'l8xa9dq');

FAQs

The following is a list of commonly asked questions about the Snowflake Native App and processing first-party segments.

What's the difference between LAST_UPDATED_ON_UTC and TIMESTAMP_UTC?

These two fields serve different purposes in managing how data is processed and retained in your integration with The Trade Desk:

Why can't I see all available procedures?

If you find that you cannot complete a key basic procedure, it's likely that you haven't been assigned the application role necessary to complete the task or procedure.

For example, if you don't have the APP_ADMIN application role, you might see the following error on trying to run the SP_START_SEGMENT_TASK task:

SQL compilation error: Unknown user-defined function APP.SP_START_SEGMENT_TASK.

If this happens, ask someone with the app owner's role (the role that installs the app) to assign the necessary application role to you.

For details, see Application roles.

Next steps

If you uploaded event data only for measurement, your integration is complete.

If you uploaded event data as part of a product catalog integration, the next step is to activate the data through your product catalog. To share access, continue to Step 4. Manage product catalog access. After an advertiser has access to the catalog, they can create product lists to build audiences and measure sales performance.