You can write job results from Treasure Data directly to Criteo Marketing API.

Criteo provides creative ad control, targeting options, and media buying all in one platform.


Prerequisites

  • Basic knowledge of Treasure Data, including the TD Toolbelt

  • A Criteo Marketing API account

  • Authorized Treasure Data account access to Criteo

Use the TD Console to Create Your Connection

Create a New Connection

In Treasure Data, you must create and configure the data connection prior to running your query. As part of the data connection, you provide authentication to access the integration.

1. Open TD Console.
2. Navigate to Integrations Hub Catalog.
3. Search for and select Criteo.

4. Select Create Authentication.
5. Select Next.

6. Name your connection.
7. Select Done.
8. Contact Support to provide a consent URL (Ex: https://consent.criteo.com/request?nonce=xxxxxxxxxx&hmac=xxxxxxxxxx) .
9. You must open this link on a browser.
10. Grant access to advertisers like this.
11. Approve the change.



Obtain Your Advertiser ID

This ID is required to export your data to Criteo.

1. Login into https://account.criteo.com/auth/XUI/criteo-login/
2. Select the Management Center.

3. Retrieve the advertiser ID from the URL. For example:


Define your Query

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


  1. Complete the instructions in Creating a Destination Integration.
  2. Navigate to Data Workbench > Queries.

  3. Select a query for which you would like to export data.

  4. Run the query to validate the result set.

  5. Select Export Results.

  6. Select an existing integration authentication.
  7. Define any additional Export Results details. In your export integration content review the integration parameters.
    For example, your Export Results screen might be different, or you might not have additional details to fill out:
  8. Select Done.

  9. Run your query.

  10. Validate that your data moved to the destination you specified.

Column Naming

Data exported to Criteo must follow the Criteo schema. Supported column names are:

  • id : The audience ID

  • name : The audience name

  • operation : The operation (add or remove) to perform on an audience

  • schema : The type of identifier represented in the row of data.  In this case, you must specify 'gum' .

  • userid : The identifier to add or remove from an audience

  • gumid : The GUM caller ID, data required for gum schema. In this case, you must specify 359 because the caller is TreasureData.

Example:

 SELECT 
 audience_id_column   AS id,
 audience_name_column AS name,
 'add'                AS operation,
 'gum'                AS schema,
 ${criteo_id}         AS userid,
 359                  AS gumid
FROM
 your_table

Integration Parameters for Criteo


Parameter
Description
Advertiser IDrequired

The ID used to group audiences under.


Maximum Identities Per Request

optional

Default: 50000

The maximum number of IDs to include per request. The maximum number for the Criteo interface is 50000. 

Retry Limit

optional

Default: 7

The number of times to attempt a network operation. 

Connect Timeout in Seconds

optional

Default: 300

The time, in seconds, to wait until aborting a connection operation. Default: 300, which is equivalent to 5 minutes.

Read Timeout in Seconds

optional

Default: 900

The time, in seconds, to wait until aborting a read operation. Default: 900, which is equivalent to 15 minutes.

Write Timeout in Seconds

optional

Default: 900

 The time, in seconds, to wait until aborting a write operation. Default: 900, which is equivalent to 15 minutes.

Example Query

SELECT
 audience_id_column   AS id,
 audience_name_column AS name,
 operation_column     AS operation,
 schema_column        AS schema,
 userid_column        AS userid,
 gumid_column         AS gumid
FROM
 your_table
;


The following is a sample configuration:


Optionally Schedule the Query Export Jobs

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


1. Navigate to Data Workbench > Queries.
2. Create a new query or select an existing query.
3. Next to Schedule, select None.

4. In the drop-down, select one of the following schedule options.

Drop-down ValueDescription
Custom cron...

Review 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.
NoneNo schedule.

Custom cron... Details

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 ValueExampleExample 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.
5.  (Optional) If you enabled the Delay execution, you can delay the start time of a query.

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 imported to the specified container destination.


Scheduled jobs that continuously fail due to configuration errors may be disabled on the system side after several notifications.



Optionally Configure Export Results in Workflow

Within Treasure Workflow, you can specify the use of this data connector to export data.

Learn more at Using Workflows to Export Data with the TD Toolbelt.

Within Treasure Workflow, you can specify the use of the data connector to output data.

timezone: UTC

_export:
  td:
    database: sample_datasets

+td-result-into-criteo:
  td>: queries/sample.sql
  result_connection: your_connections_name
  result_settings:
    advertiser_id: 12345
    request_threshold: 50000
    request_retries: 7
    request_connect_timeout: 300
    request_read_timeout: 900
    request_write_timeout: 900


FAQ for Export into Criteo

Q: Where do I confirm audience ID?

  • To confirm audience ID, check with the tool provided by Criteo. (https://marketing.criteo.com/audiences?advertiserId={advertiserId})

Q: Are both the audience ID and audience name required to not be NULL?

  • No. Either the audience ID or audience name must be non-NULL, not both. If the audience ID and audience name are both provided, then the values must be present within the same audience.

Q: If audience ID or audience name do not exist in the list of audiences, will they be created?

  • If an audience name is provided and the audience ID is NULL, an audience is created if the audience name is not found in the list of audiences.

  • If an audience ID is provided, an audience cannot be created if the audience ID is not found in the list of audiences. The Criteo API does not allow the audience ID to be specified when creating an audience.

Q: How long does it take for my audience to be updated when adding or removing users?

  • Criteo can take up to 24 hours to process the data and make it available for display. The data is stored in Criteo's system but takes some time to be processed.

Q: How do I check upload result?

  • Check with tool provided by Criteo (https://marketing.criteo.com/audiences?advertiserId={advertiserId}).

FAQ for Log Messages

Q: Log: Columns [<name(s)>] were not found.

  • The column names listed in the message were missing from the query.

  • Check the query to ensure that the column names are not missing or they are not misspelled.

Q: Log: Created audience id '<id>' for audience name '<name>'

  • The audience name was not found within the list of audiences for the advertiser ID provided. The audience is created only if the name does not exist and the ID value provided by the query is NULL.

Q: Log: Audience id '<id>' is not found in the list of audiences for advertiser '<id>'. Cannot create a new audience for non-existent id

  • If the audience ID value provided by the query is not NULL and the audience ID does not exist within the list of audiences for the advertiser ID provided, then the audience cannot be created by the connector. The audience ID provided does not match the audience ID generated by the Criteo API and causes a data mismatch.

  • Create an audience and update data entries of unknown audience IDs with newly created audience IDs.

Q: Log: Audience name '<name>' is not found in the list of audiences for advertiser '<id>' but audience id '<id>' is found. Cannot create a new audience due to name mismatch

  • Both the audience ID and name were provided by the query but the audience name was not found in the list of audiences for the advertiser ID provided. Providing the name as part of the Criteo API operation is invalid.

  • Make the name NULL in the database or update the audience name to match the name provided by the query.

Q: Log: Audience id '<id>' and audience name '<name>' do not represent the same audience for advertiser '<id>'

  • The audience name associated with ID does not match the audience name provided by the query.

  • If both the audience ID and name are provided by the query and are not NULL, both values must be associated with the same audience. You can update the audience name associated with the ID to match the name provided by the query or you can modify the row of data and set the name to match the name value within the audience.


  • No labels