# Snapchat Conversions API Export Integration This feature is in BETA version. For more information, contact your Customer Success Representative. ## Overview The Snapchat Conversions API (CAPI) connector enables server-side tracking and measuring conversion events across web, mobile, and offline channels. By integrating directly with Snapchat's Events Manager, this connector helps businesses measure campaign performance and optimize ad delivery more effectively across Snapchat's 300M+ daily active users. Key capabilities: - **Web Events**: Server-side tracking to complement pixel data for enhanced measurement accuracy - **Mobile App Events**: Direct integration of in-app conversion events - **Offline Events**: Support for non-digital conversions like in-store purchases - **Data Validation**: Automated event validation and formatting to Snapchat's CAPI specifications This server-side integration provides more reliable conversion tracking and improved advertising performance measurement compared to client-side solutions alone. ## Prerequisites - Basic knowledge of Treasure Data, including the TD Toolbelt. - Basic knowledge of Snapchat Business. - Snapchat Access Token or Snapchat Business account ## Limitations & Known Issues - Event Time Restrictions - Events older than 7 days (based on `event_time`) will be skipped during processing - Event time validations use UTC timezone for epoch conversions and 7-day window calculations - Invalid Event Source ID Error Message Discrepancies between oAuth Authentication and Conversion API token authentication - Different authentication methods produce varying error responses for invalid `event_source_id`: - When using Conversion API Token Authentication, the error message will be: ```json { "status": "INVALID", "reason": "Unauthorized resources" } ``` - When using OAuth Authentication, the error message will be: ```json { "status": "INVALID", "test_event": true, "reason": "At least one of the events is invalid.", "event_logs": [ { "event": 1, "status": "INVALID", "errors": { "codes": [ "523" ], "error_msgs": [ "The provided asset id must be valid UUID format." ] } }} ``` - When using OAuth authentication, the error response message does not explicitly indicate an invalid Event Source ID, instead referring to an invalid “asset id.” Therefore, for more reliable error handling when you’re unsure about the Event Source ID, it's recommended to use Conversion API Token authentication when running the job. - Anonymous ID Field (`anon_id`): Despite being documented as a standard field in the “User Data Parameter” section of the API documentation ([Link](https://developers.snap.com/api/marketing-api/Conversions-API/Parameters#user-data-parameters)), `anon_id` cannot be included in the `user_data` object - Attempting to use `anon_id` in `user_data` results in the following error: ```json { "status": "INVALID", "reason": "Request parsing failed. Ensure the request body is correctly formatted." } ``` - So, as a workaround, we have to map `anon_id` to the custom data object instead of the `user_data` object to avoid the API error. ## Create a New Connection via TD Console Before running your query, you must create and configure the data connection on the TD Console. As part of the data connection, you provide authentication to access the integration. Complete the following steps. ![](/assets/screenshot-at-nov-04-14-12-04.fe86b4b30398f73429a8a1d2b60f0c25f33d3bb84415d80a62f48b4bf75586f5.fe495661.png) 1. Open TD Console. 2. Navigate to **Integrations Hub > Catalog.** 3. Search for and select **Snapchat Conversions API.** Hover over the icon and select**Create Authentication.** 4. Ensure that the **Credentials** tab is selected, and then enter credential information for the integration. Choose one of the following 1. **OAuth Authentication Workflow:**Select the link "Click here" to start the OAuth authentication flow. After completing the authentication, a new OAuth connection will be created and available in the dropdown. ![](/assets/3.bed4eac368ecd5d69800b167de35e2416ac0e1c47c471c89966575eb44707e59.0efdb04c.png) Select **Continue** to create a new connection. b. **Conversion API Token Workflow**: Obtain the access token from the Snapchat Business Manager and input it in the **Conversion API Token** field. ![](/assets/4.81329c42404d19cb9ee812121d2dadbbe07437b0f2ceff5566c6851aea8ce0f4.0efdb04c.png) #### **Authentication Fields** | Parameter | Description | | --- | --- | | Authentication Mode | Authentication method. Supported values: - oAuth Connection: OAuth Authentication - Conversions API Token: Long live access token generated in the Snapchat Business Manager. | | Conversions API Token | You can obtain the Conversions API Token from the Snapchat Business Manager. This parameter is only available for Conversion API Token authentication methods. | 5. Select **Continue**. 6. Enter a name for your authentication, and select Done. ### Configure a Query Result for Export The TD Console supports multiple ways to export data. Please follow these steps to export data from the Data Workbench. 1. Navigate to **Data Workbench** > **Queries**. 2. Select **New Query**, and define your query. 3. Select **Export Results** to configure the data exporting. 4. Select an existing Snapchat CAPI authentication or create a new one described previously 5. Select **Done.** #### Connector Configuration Parameters | **Field** | **Description** | | --- | --- | | **Event Source Type** | Select the type of Snapchat event data source you are using. Supported event source types include: - Web Events - Mobile App Events - Offline Events | | **Event Source ID** | Select the specific event source to upload event data to by inputting either pixel_id for Web Events/Offline Events and snap_app_id for Mobile App Events. | | **Send test events** | Enable this to send test events instead of real traffic. | | **Skip invalid records?** | If checked, the job will skip the invalid record and continue to handle the next record. Otherwise, the job will stop. | ### Detailed Guide for Query Result Data Specs To upload event data to Snapchat CAPI, you need to build a data export query that includes a combination of standard fields and custom fields that adhere to Snapchat CAPI guidelines. For standard fields, ensure the column names match those listed in the "Field/Column-Level Specifications" section. The connector automatically normalizes the column names to match Snapchat CAPI's required format, so you do not need to worry about case sensitivity. For example, for the default field "event_name," the column name in your export query can be written in any case, such as "EVENT_NAME," "event_name," or "Event_Id." The connector will standardize the column name to "event_name" to meet Snapchat CAPI's requirements. To successfully upload/modify user profile data to Snapchat CAPI, you must construct an export query that adheres to specific data specifications. These specifications are divided into two levels: - **Export Query Specifications** (or Dataset-level data specs): This section describes the requirements and rules that apply to your entire query result dataset, such as the presence of required fields and data validation rules that span multiple fields. - **Field/Column-Level Specifications**: This section details the requirements and rules for individual fields/columns in your dataset, such as data types and formats for each field. #### Export Query Specifications | Specification | Description | | --- | --- | | **Conditionally Required Fields for User Data** | At least one of the following identifier fields must be present in your export query:- Email (`em`) - Phone (`ph`) - Snapchat click ID (`sc_click_id`) - Client IP address (`client_ip_address`)/Client user agent (`client_user_agent`) - Mobile advertiser ID (`madid`) | | **Conditionally Required Fields for PURCHASE Events** | When your export query contains PURCHASE events, the following fields are required:- `currency` (must be a valid ISO 4217 code) - `value` (must be a numeric value) | | **Standard Field Names** | Column names for standard fields can be written in any case (e.g., "EVENT_NAME", "event_name", "Event_Name"). The connector automatically standardizes them to match Snapchat CAPI requirements. | | **Null Value Handling** | Columns with NULL values are ignored during export. | | **Duplicated Columns** | Duplicate column names within the export query are not allowed. | | **Custom Fields** | Any fields not listed in the standard fields will be automatically mapped to the `custom_data` object and preserved as-is. No normalization/formatting will be done. | | **Date-Time Formatting** | For the `event_time` field, the following formats are accepted:- Integer (Unix epoch timestamp) with 10 or more digits - ISO 8601 formatted string - Timestamp data type | | **Array Field Formatting** | For fields that accept arrays (e.g., `content_ids`, `content_category`, `suggested_destinations`): they can be constructed using either: 1. Single column containing array values or 2. Flattened column names with numeric suffixes **Flattened Column Pattern:** `field_name_[index]` where the index starts from 1 **Example:** To create an array field `cont_id` with three values, you can use these columns: - `cont_id_1` - `cont_id_2` - `cont_id_3` These will be automatically combined into: `["value1", "value2", "value3"]` | | **JSON Object Array Construction** | The `contents` field for the PURCHASE event must be formatted as a list of JSON objects, each containing optional fields: - `id` (string) - `quantity` (integer) - `item_price` (float) - `delivery_category` (string) Arrays of objects can be constructed using flattened column names in the pattern: `field_name_property_name_[index]` **Example:** To create the `contents` array of objects in `data[].custom_data.contents`, you can use: First object: - `content_id_1` - `content_quantity_1` - `content_item_price_1` - `content_delivery_category_1` Second object: - `content_id_2` - `content_quantity_2` - `content_item_price_2` - `content_delivery_category_2` This will be automatically constructed as: ```json [ { "id": "ABC123", "quantity": 2, "item_price": 29.99, "delivery_category": "standard" }, { "id": "XYZ789", "quantity": 1, "item_price": 49.99, "delivery_category": "express" } ] ``` | | **Date Field Formats** | The checkin_date date field for the Custom Data object accepts the following formats:- YYYYMMDD - YYYY-MM-DD | | **Required Fields for App Events** | When sending app events, the following fields are required in your export query:- `advertiser_tracking_enabled` (Boolean) - `extinfo` (array of exactly 16 elements) - `app_id` (string) | | **extinfo Array Requirements** | The `extinfo` field must:- Contain exactly 16 elements - Start with "i2" (iOS) or "a2" (Android) as the first element | | **Hashed Field Handling** | For fields requiring SHA256 hashing in the `user_data` object, the connector will handle different scenarios as follows: 1. Already Hashed Data: - If data is already hashed with SHA256 (verified by HEX pattern), it will be used as-is - If data is hashed but not with SHA256, it will be treated as raw data and re-hashed 2. Raw Data: - Email (`em`): Will be validated for email format, then normalized and hashed - Other fields (`ph`, `fn`, `ln`, etc.): Will be normalized and hashed without format validation **Note**: The connector handles all normalization/hashing automatically - you can provide either raw or SHA256 hashed data | #### Field/Column-Level Specifications There is Special Field Handling **Country Field** - For `user_data` object: Use column name “country” (case-insensitive) - For `custom_data` object: Use column name “custom_country” (case-insensitive) **Punctuation Marks Removal** Specific fields require the removal of punctuation marks. When this applies, the following characters will be removed: - Basic punctuation: `. , ! ? ; : - — " ' ( ) [ ] { } / _` - Special characters: `& * + = @ # $ % ^ ~ |` **Handling Date-Time** The integration can handle values cast as timestamps or in ISO-8601 date-time string format for date-time custom field columns. When using ISO-8601 date-time strings, ensure the value includes the letter “Z” at the end to allow the connector to detect and convert the date-time value into a Unix time value as required by Snapchat CAPI’s API contract. **Examples for Handling Date-Time Custom Field Columns** **1. Casting as Timestamp** - Create a column of type string in the source data table: ```sql ALTER TABLE source_data_table ADD COLUMN date_time_field VARCHAR; ``` - Insert date-time value strings into that column: ```sql INSERT INTO source_data_table (id, date_time_field)VALUES(1, '2024-08-28'),(2, '2024-08-28 15:30:00'),(3, '2024-08-28T15:30:00'); ``` - Cast the column value as timestamp: ``` SELECT id, CAST(date_time_field AS timestamp) AS date_time_field FROM source_data_table; ``` **2. Using ISO-8601 Date-Time String** - Create a column of type string in the source data table: ``` ALTER TABLE source_data_table ADD COLUMN date_time_field VARCHAR; ``` - Insert date-time value strings into that column, ensuring they are formatted as ISO-8601 with a “T” separator and “Z” at the end: ``` INSERT INTO source_data_table (id, date_time_field)VALUES(1, '2024-08-28T00:00:00Z'),(2, '2024-05-28T15:30:00.123Z'),(3, '2024-02-28T15:30:00Z'); ``` - Use the column directly in the query: ``` SELECT id, date_time_field FROM source_data_table; ``` #### Standard Fields for Server Parameters (Top-level parameters) | Field | Description | Required | Data Type | Additional Specifications | | --- | --- | --- | --- | --- | | event_name | The type of event being tracked | Yes | String | Must be one of the following values:- PURCHASE - SAVE - START_CHECKOUT - ADD_CART - VIEW_CONTENT - ADD_BILLING - SIGN_UP - SEARCH - PAGE_VIEW - SUBSCRIBE - AD_CLICK - AD_VIEW - COMPLETE_TUTORIAL - LEVEL_COMPLETE - INVITE - LOGIN - SHARE - RESERVE - ACHIEVEMENT_UNLOCKED - ADD_TO_WISHLIST - SPENT_CREDITS - RATE - START_TRIAL - LIST_VIEW - APP_INSTALL - APP_OPEN - CUSTOM_EVENT_1-5 | | event_time | Timestamp of the event occurrence | Yes | Integer/String/Timestamp | - If integer: Must be Unix epoch timestamp with 10+ digits - If string: Must be ISO 8601 format - If timestamp: Will be converted to epoch milliseconds - Cannot be more than 7 days in the past | | event_source_url | URL where the event occurred | Yes (for web events) | String | Must include protocol (http/https) Example: [https://example.com/page](https://example.com/page) | | event_id | Unique identifier for the event | No | String | Chosen by the advertiser to represent a unique event | | action_source | Source of the event | Yes* | String | *Automatically set based on configuration screen selection:- WEB - OFFLINE - MOBILE_APP | | data_processing_options | Privacy processing options | No | Array of strings | Accepted values: ["LMU"], ["DELETE"] | | advertiser_tracking_enabled | Tracking permission indicator | No | Boolean | - 1 for OPT_IN - 0 for OPT_OUT - For web events: Used in top-level parameters - For app events: Used in app data object | #### Standard Fields for User Data Object The following fields are used to identify users and their attributes. At least one identifier field is required from: email (em), phone (ph), sc_click_id, client_ip_address, client_user_agent, or mobile advertiser id (madid). | Field | Description | Required | Data Type | Formatting Requirements | Example | | --- | --- | --- | --- | --- | --- | | em | Email address | Conditional* | String/Array | - Spaces are trimmed - Converted to lowercase - Must be valid email format - Will be automatically hashed | Input: `Person@Example.com` Normalized: `person@example.com` | | ph | Phone number | Conditional* | String/Array | - Spaces removed - Leading ‘00’ and ‘0’ removed - Non-numeric chars, ‘+’, ‘-’ excluded - Must include country code - Will be automatically hashed | Input: `+44 844 412 4653` Normalized: `448444124653` | | sc_click_id | Snapchat click ID from URL | Conditional* | String | - Must be in UUID format - Found in landing page URL’s ScCid parameter | `123e4567-e89b-12d3-a456-426614174000` | | client_ip_address | Device IP address | Conditional* | String | - Supports IPv4 and IPv6 - Must be device IP, not server IP | `203.0.113.195` | | client_user_agent | Device user agent | Conditional* | String | No special formatting required | `Chrome/87.0.4180.143` | | madid | Mobile advertiser ID | Conditional* | String | Automatically converted to lowercase | Input: `123ABC` Normalized: `123abc` | *At least one of these identifier fields is required. ##### Optional User Attributes | Field | Description | Data Type | Data handling | | --- | --- | --- | --- | | fn | First name | String/Array | - Converted to lowercase - Punctuation removed - Special characters UTF-8 encoded - Will be automatically hashed | | ln | Last name | String/Array | - Converted to lowercase - Punctuation removed - Special characters UTF-8 encoded - Will be automatically hashed | | ge | Gender | String/Array | - Converted to lowercase - Accepted values: ‘f’ for female, ‘m’ for male - Will be automatically hashed | | ct | City | String/Array | - Converted to lowercase - Punctuation and spaces removed - Special characters UTF-8 encoded - Will be automatically hashed | | st | State | String/Array | - US: Use 2-character ANSI code - Converted to lowercase - No punctuation, special chars, or spaces - Will be automatically hashed | | zp | Zip/postal code | String/Array | - Converted to lowercase - Spaces and ‘-’ removed - US: Use 5 digits - Will be automatically hashed | | country | Country | String/Array | - Converted to 2-letter ISO 3166-1 alpha-2 code - Converted to lowercase - Will be automatically hashed | ##### Additional Identifier Fields | Field | Description | Required | Notes | | --- | --- | --- | --- | | external_id | Unique identifier (e.g., loyalty card ID) | No | Will be automatically hashed | | subscription_id | Subscription identifier | No | | | lead_id | Snapchat Lead Ad identifier | No | | | anon_id | App install identifier | No | For app events only, this field will be mapped to custom_data object to avoid Snapchat API error | | download_id | App download identifier | No | | | sc_cookie1 | First-party cookie from Pixel SDK | No | Must be UUID format | | idfv | IDFV value | No | Plain text value | ##### Important Notes about User Data: 1. **Conditional Requirements**: You must include at least one of the conditional identifier fields (em, ph, sc_click_id, client_ip_address, client_user_agent, or madid). 2. **Automatic Processing**: The connector automatically handles: - Field normalization (lowercase conversion, space removal, etc.) - Hashing of sensitive fields - UTF-8 encoding where required 3. **Multiple Values**: Fields marked as String/Array can accept either a single value or multiple values #### Standard Fields for Custom Data Object ##### E-Commerce Related Fields | Field | Description | Required | Data Type | Additional Specifications | | --- | --- | --- | --- | --- | | content_category | Item or category classification | No | String/Array | - Can be a single value or array Example: `"shoes"` or `["coats", "shoes", "umbrellas"]` | | content_ids | Product/category identifiers | No | Array | - Can be a single ID or comma-separated list Example: `"sku001"` or `["sku001", "sku002", "sku003"]` | | content_name | Page/product name | No | String | Example: `"Running Shoes"` | | content_type | Type of content identifier | No | String | - Accepted values: `product`, `product_group` | | contents | Detailed item purchase information | No | Array of Objects | - Each object may include: • id (string) • quantity (integer) • item_price (float) • delivery_category (string) Example: `[{"id": "123", "quantity": 2, "item_price": 29.99, "delivery_category": "standard"}]` | | currency | Transaction currency | Yes for PURCHASE | String | - Must be standard ISO 4217 code (e.g., USD, AED, AUD) | | num_items | Total item count | No | String | Example: `"3"` | | order_id | Order identifier | No | String | Example: `"ORD12345"` | | predicted_ltv | Predicted lifetime value | No | Float | Example: `150.75` | | value | Event monetary value | Yes for PURCHASE | Float | Example: `99.99` | | search_string | Search query text | No | String | Example: `"running shoes"` | ##### Travel-Related Fields | Field | Description | Required | Data Type | Example | | --- | --- | --- | --- | --- | | checkin_date | Hotel check-in date | No | String | Format: YYYY-MM-DD Example: `"2024-09-13"` | | travel_start | Travel start date | No | String | Example: `"2024-09-13"` | | travel_end | Travel end date | No | String | Example: `"2024-09-20"` | | suggested_destinations | Recommended destinations | No | String/Array | Example: `["destination1", "destination2"]` | | destination_airport | IATA code of destination | No | String | Example: `"JFK"` | | origin_airport | IATA code of origin | No | String | Example: `"LAX"` | ##### Location-Related Fields | Field | Description | Required | Data Type | Example | | --- | --- | --- | --- | --- | | country | Destination country | No | String | Example: `"US"` | | city | Destination city | No | String | Example: `"New York"` | | region | State/district/region | No | String | Example: `"NY"` | | neighborhood | Specific neighborhood | No | String | Example: `"Brooklyn"` | | postal_code | Postal/zip code | No | String | Example: `"10001"` | ##### Travel Schedule Fields | Field | Description | Required | Data Type | Example | | --- | --- | --- | --- | --- | | departing_departure_date | Outbound departure | No | String | Example: `"2024-09-13T08:00"` | | departing_arrival_date | Outbound arrival | No | String | Example: `"2024-09-13T12:00"` | | returning_departure_date | Return departure | No | String | Example: `"2024-09-20T08:00"` | | returning_arrival_date | Return arrival | No | String | Example: `"2024-09-20T12:00"` | ##### Accommodation-Related Fields | Field | Description | Required | Data Type | Example | | --- | --- | --- | --- | --- | | num_adults | Number of adults | No | Integer | Example: `2` | | num_children | Number of children | No | Integer | Example: `1` | | num_infants | Number of infants | No | Integer | Example: `0` | | hotel_score | Hotel rating score | No | String | Example: `"4.5"` | | preferred_neighborhoods | Preferred areas | No | String/Array | Example: `["neighbor1", "neighbor2"]` | | preferred_star_ratings | Hotel star rating range | No | String/Array | Example: `["star1", "star2"]` | | suggested_hotels | Recommended hotels | No | String/Array | Example: `["hotel1", "hotel2"]` | | destination_ids | Catalog destination IDs | No | String/Array | Example: `["dest1", "dest2"]` | #### Standard Fields for App Data Object | Field | Description | Required | Data Type | Additional Specifications | | --- | --- | --- | --- | --- | | advertiser_tracking_enabled | User tracking opt-in status | Yes | Boolean | - `1` for OPT_IN - `0` for OPT_OUT - For iOS 14.5+: Set to ATT Authorization Status | | app_id | Application identifier | Yes | String | - iOS: Numeric format (e.g., `447188370`) - Android: Package name format (e.g., `com.snapchat.android`) | | extinfo | Device and app information | Yes | Array | Must contain exactly 16 elements in a specific order (see detailed specs below) | ##### extinfo Array Specifications The `extinfo` array must contain exactly 16 elements in the following order,  use the exact column name as specified in the "Column Name" for the connector to build the accurate array: | Index | Column Name | Description | Data Type | Requirements | Example | | --- | --- | --- | --- | --- | --- | | 0 | device_os | OS identifier | String | Must be “i2” (iOS) or “a2” (Android) | `"i2"` | | 1 | package_name | App package name | String | | `"com.snapchat.sdk"` | | 2 | short_version | App short version | String/Integer | | `"1.0"` | | 3 | long_version | App long version | String | | `"1.0"` | | 4 | os_version | Device OS version | String | | `"10.3.1"` | | 5 | device_model | Device model | String | | `"iphone14"` | | 6 | locale | Device locale | String | | `"En_US"` | | 7 | timezone_abbr | Timezone abbreviation | String | | `"EDT"` | | 8 | carrier | Mobile carrier | String | | `"AT&T"` | | 9 | screen_width | Screen width | Integer | Must be Int64 | `320` | | 10 | screen_height | Screen height | Integer | Must be Int64 | `568` | | 11 | screen_density | Screen density | String | | `"2"` | | 12 | cpu_cores | Number of CPU cores | Integer | Must be Int64 | `2` | | 13 | storage_size | Total storage (GB) | Integer | Must be Int64 | `15` | | 14 | free_storage_size | Available storage (GB) | Integer | Must be Int64 | `8` | | 15 | timezone_location | Device timezone | String | | `"USA/New York"` | Example complete `extinfo` array: ``` ["i2", "com.snapchat.sdk", "1.0", "1.0", "10.3.1", "iphone14", "En_US", "EDT", "AT&T", "320", "568", "2", "2", "15", "8", "USA/New York"] ``` ##### Important Notes for App Events: 1. All three fields (`advertiser_tracking_enabled`, `app_id`, and `extinfo`) are required for app events 2. The `extinfo` array must maintain the exact order specified above 3. Integer values in `extinfo` must be provided as Int64 type 4. First element of `extinfo` determines the platform (iOS/Android) ### (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). ## (Optional) Export Integration Using the CLI You can also use CLI (Toolbelt) to export results to Snapchat Conversion CAPI. You need to specify the information for export to your Snapchat server using the `*--result` option of*the *`td query`* command. For more information about the *`td query`*command, refer to [this article](https://docs.treasuredata.com/display/PD/TD+Toolbelt+Job+and+Query+Command+Reference). The format of the option is JSON, and the general structure is as follows. ```json { "type": "snapchat_conversion", "auth_method": "oauth", "oauth_credentials_id": "xxxxxxxxxxx", "event_source_type": "web", "event_source_id": "xxxxxxxxxxx", "send_test_events": false, "skip_invalid_records": true } ``` ```json { "type": "snapchat_conversion", "auth_method": "api_token", "api_token": "xxxxxxxxxxx", "event_source_type": "web", "event_source_id": "xxxxxxxxxxx", "send_test_events": false, "skip_invalid_records": true } ``` ### Parameters | Name | Description | Value | Default Value | Required | | --- | --- | --- | --- | --- | | type | connector type | snapchat_conversion | N/A | Yes | | auth_method | Authentication method | Supported values: - oauth - api_token | oauth | Yes | | api_token | Conversion Api Token | N/A | N/A | yes ( if the authentication method is Conversion Api Token) | | oauth_credentials_id | Credential id that was created by authentication method OAuth on the console | N/A | N/A | yes ( if the authentication method is oAuth) | | event_source_type | event source type | Supported event sources: - WEB - MOBILE_APP - OFFLINE | WEB | Yes | | event_source_id | The pixel id or application id on snapchat dashboard. | N/A | N/A | Yes | | send_test_events | Send data to Validation API | true/false | false | No | | skip_invalid_records | The flag to continue or stop the job when handling the invalid record. | true/false | true | No | ### Example for Usage OAuth authentication ```bash $ td query --result '{"type":"snapchat_conversion","auth_method":"oauth","oauth_credentials_id":"xxx","event_source_type":"WEB","event_source_id":"xxx", "send_test_events":false,"skip_invalid_records":true}' -d sample_datasets "select ........ from ........" -T presto ``` API Token authentication ```bash $ td query --result '{"type":"snapchat_conversion","auth_method":"api_token","api_token":"xxx","event_source_type":"WEB","event_source_id":"xxx", "send_test_events":false,"skip_invalid_records":true}' -d sample_datasets "select ........ from ........" -T presto ``` ## Related articles #### Other Configurations - The Result Export can be [scheduled](https://docs.treasuredata.com/articles/pd/scheduling-jobs-using-td-console) to periodically upload data to a target destination. - All import and export integrations can be added to a [TD Workflow](https://docs.treasuredata.com/articles/pd/about-treasure-workflow). The **td** data operator can export a query result to a specified integration. For more information, see [Reference for Treasure Data Operators](https://docs.treasuredata.com/articles/pd/reference-for-treasure-data-operators/a/h1_76525622).