You can write job results from Treasure Data directly to Snapchat. Use this data connector to create User Segments, upload data into existing segments, and remove users from a segment. The connector supports follow features:

  • Add or remove users from multiple segments

  • Auto-create a new segment if the segment does not exist

  • Auto-detect and hash the user id (email, phone or mobile_ad_id) if the value is not hashed

  • Specify an option to skip or stop on invalid values


Prerequisites


  • Basic knowledge of Treasure Data, including the TD toolbelt

  • A valid Snapchat Ad Account account

  • Authorized Treasure Data account access to Snapchat Marketing account

Use the TD Console to Create Your Connection

Create a New Connection

You must create and configure the data connection, to be used during export, prior to running your query. As part of the data connection, you provide authentication to access the integration.

Go to Catalog and search and select Snapchat.


The following dialog opens.


Authenticating Your Connection

Select Click here to connect to a new account. You are redirected to Snapchat to login, if you haven't login yet, or to the consent page to grant access to Treasure Data.



You will be redirected back to TD Console. Repeat the first step (Create a new connection) and choose your new OAuth connection.

Enter your Ad Account ID. See Appendix: What is my Ad Account ID.

Select Continue and name your new Snapchat connection. Select Done.


Configure Export Results in Your Data Connection

In this step, you create or reuse a query. In the query, you configure the data connection.

Note: Sometimes you need to define the column mapping in the query.

Configure the Connection by Specifying the Parameters

Go to the TD Console. Go to Data Workbench > Queries. Access the query that you plan to use to export data.

Select Export Results located at top of your query editor.

The Choose Integration dialog opens. You have two options when selecting a connection to use to export the results:

  1. Use an existing connection
    Type the connection name in the search box to filter and select your connection.

    The dialog opens


  2. Create a new Snapchat Connection
    Select New Integration, select Snapchat from Type dropdown. You see the following:

    Select Save and Continue. You see:


Complete the steps described in Create a new connection, including the creation of an OAuth connection.

Enter the required credentials for your new SnapChat connection.

Set the following parameters.

  • Segment Operation (required): add or remove users from segments

  • Skip Invalid Data: option to skip invalid rows and segments and to continue importing others. Invalid rows are listed in the job log. If this option is not selected, jobs terminate when an invalid record is encountered and uploaded data is not reverted.

  • Max users uploaded per request (required): the maximum number of users uploaded in a single request. Default is 100000. Accepted value from 1-200000. If you specify more than 100000 users per request, you might receive an error message from Snapchat due to the limitation of uploaded users per request. The job splits the upload data into multiple requests based on this parameter. The query requests are processed until finished and all data is uploaded.

Column Name for the Query

The Snapchat data connector understands and interprets only the following columns and data types. You must modify alias column names to match with the following specified columns:

Column name

Type

Required


Default

Description

segment_id

string

optional


if both segment_id and segment_name are specified, the segment_id will be used.

segment_name

string

optional


If the segment_name does not exist in Snapchat.

  • Create a new segment with the same name if Segment Operation is Add Users

  • Treated as invalid data if Segment Operation is Remove Users

segment_description

string

optional



retention_in_days

integer

optional

9999

Set default as 9999 if 0 or not specified. Accept value from 1 to 9999

id_type

string

required


Must be either

  • email

  • phone

  • mobile_ad_id

id_value

string

required


Either SHA256 hashed or raw value of email, phone, mobile_ad_id


You must include either segment_id or segment_name column in the Query otherwise your jobs fail.

Example Queries to Populate Snapchat Data

From Treasure Data, run the following query with export results into a connection for Snapchat:

The following example query uploads all emails to the existing Segments specified by segment_id if Segment Operation is specified as Add Users.

SELECT 
 segment_id AS segment_id,
 'email' AS id_type,
 email AS id_value
FROM
 my_table;

The following example query checks for the segment Football fans or creates a new segment with a Retention of 30 days if Segment Operation is specified as Add Users.

SELECT 
 'Football fans' AS segment_name,
 30 AS retention_in_days,
 'phone' AS id_type,
 mobile_phone AS id_value
FROM
 my_table

Optional: Use of Scheduled Jobs for Export

You can use Scheduled Jobs with Result Export to periodically write the output result to a target destination that you specify.

FAQ

Q: Why is Reach in Snapchat Audiences list unchanged after I uploaded users?

  • Snapchat takes up to 72 hours to process and match your uploaded users with its database. When the process is finished, the audience number is updated and the status is set to Ready.

Q: Why does the Reach in Snapchat Audiences list increase after I remove users?

  • After sending requests to remove users from Audiences list, Snapchat may show temporary uploaded users. You must wait until Snapchat finishes the process of matching and removing. The process can take up to 72 hours. The process is complete when you see the status set to Ready.

Appendix

Ad Account ID

To find your Ad Account ID, log in your Business account, navigate to the Ad Account as shown in the following image. From there, you can see your Ad Account ID.


Find the Segment ID

When working with Segments, you need either Segment name or Segment ID. Here's how to find the Segment ID from your browser:

  • Log into your Snapchat Ad Account

  • Go to the Audiences section.

  • Select an existing Segment

  • The Segment ID is on the address bar of your browser as follows:


  • No labels