Skip to content
Last updated

Amazon Ads Conversion Export Integration

Amazon Ads Conversion API (CAPI) enables advertisers to send conversion events and customer actions directly from Treasure Data to Amazon Advertising for attribution and measurement purposes. This server-to-server integration bypasses browser limitations and provides more reliable conversion tracking.

The Amazon Ads Conversion Export integration supports Treasure Data users in sending conversion events with enhanced privacy compliance and improved attribution accuracy for Amazon DSP and Sponsored Ads campaigns.

Prerequisites

  • Basic knowledge of Treasure Data
  • Basic knowledge of Amazon Ads campaign management and conversion tracking
  • Access to Amazon Ads account with conversion API permissions
  • Understanding of conversion events and attribution models

Requirements and Limitations

  • At least one customer identifier must be provided per event
  • Maximum batch size: 500 events per request
  • Events should be sent as close to real-time as possible for optimal attribution
  • PII fields must be normalized and SHA-256 hashed according to Amazon's requirements; non-PII identifiers follow Amazon's field-specific requirements

Static IP Address of Treasure Data Integration

If your security policy requires IP whitelisting, you must add Treasure Data's IP addresses to your allowlist to ensure a successful connection.

Please find the complete list of static IP addresses, organized by region, at the following document

Use Data Workbench to Create a Connection

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

Create a New Authentication

Your first step is to create a new authentication with a set of credentials.

  1. Select Integrations Hub.
  2. Select Catalog.

Integrations Hub Catalog

  1. Search for Amazon Ads Conversion in the Catalog; hover your mouse over the icon and select Create Authentication.

Create Authentication

The New Authentication modal displays.

  1. Below the OAuth connection field, select the Click here link.
  2. Log in to your Amazon account to approve OAuth access.
  3. On the New Authentication modal, provide this information and select Continue.
  4. Enter a name for the authentication, and select Done.

Getting the Authentication ID

If you want to use this authentication with Treasure APIs or with the TD Toolbelt, you will need to get its Authentication ID.

To get the Authentication ID:

  1. Navigate to Integrations Hub > Authentications.
  2. Select the integration you want to use. The Edit Authentication modal displays.
  3. In the browser address bar, at the end of the URL, note the Authentication ID.

Define your Query

  1. Navigate to Data Workbench > Queries.
  2. Select New Query.
  3. From the table drop-down menu, select the database you want to query.
  4. Enter your query.

Here is a sample query:

SELECT   
  'Product Purchase'                AS event_name,              -- required
  'OFF_AMAZON_PURCHASES'            AS conversion_type,         -- required
  'WEBSITE'                         AS event_source,            -- required
  'US'                              AS country_code,            -- required
  purchase_time                     AS event_time,              -- required
  customer_email                    AS email,                   -- conditional (hashed)
  customer_phone                    AS phone,                   -- conditional (hashed)
  customer_first_name               AS first_name,              -- conditional (hashed)
  customer_last_name                AS last_name,               -- conditional (hashed)
  quantity                          AS units_sold,              -- conditional
  purchase_value                    AS value,                   -- optional
  'USD'                             AS currency_code,           -- optional
  order_id                          AS event_id,                -- optional
  product_category                  AS custom_field_1,          -- optional custom data
  customer_segment                  AS custom_field_2           -- optional custom data
FROM   
  conversion_events
WHERE
  TD_INTERVAL(purchase_time, '-1d', 'JST')

Here are the required and conditional fields for the query:

FieldRequiredData TypeHash RequiredDescription
event_nameYesSTRINGNoThe name of the conversion event
conversion_typeYesSTRINGNoMust be one of: OFF_AMAZON_PURCHASES, ADD_TO_SHOPPING_CART, APPLICATION, CHECKOUT, CONTACT, LEAD, MOBILE_APP_FIRST_START, PAGE_VIEW, SEARCH, SIGN_UP, SUBSCRIBE, OTHER
event_sourceYesSTRINGNoMust be one of: ANDROID, FIRE_TV, IOS, OFFLINE, WEBSITE, MEASUREMENT_ATTRIBUTION_PARTNER
country_codeYesSTRINGNoISO 3166-1 alpha-2 country code (US, CA, JP, etc.)
event_timeYesSTRING/LONGNoISO format (YYYY-MM-DDThh:mm:ssTZD) or Unix timestamp
emailConditionalSTRINGYesCustomer email address (SHA-256 hashed)
phoneConditionalSTRINGYesCustomer phone number with country code (SHA-256 hashed)
first_nameConditionalSTRINGYesCustomer first name (SHA-256 hashed)
last_nameConditionalSTRINGYesCustomer last name (SHA-256 hashed)
addressConditionalSTRINGYesStreet address (SHA-256 hashed)
cityConditionalSTRINGYesCity name (SHA-256 hashed)
stateConditionalSTRINGYesState/province (SHA-256 hashed)
postalConditionalSTRINGYesPostal/zip code (SHA-256 hashed)
maidConditionalSTRINGNoMobile advertising ID
match_idConditionalSTRINGNoCustom match identifier
units_soldConditionalLONGNoOnly for conversion_type is OFF_AMAZON_PURCHASES
valueNoSTRING/LONG/DOUBLENoConversion value (numeric)
currency_codeNoSTRINGNoOnly for conversion_type is OFF_AMAZON_PURCHASES. Must be one of: AED, AUD, BRL, CAD, CNY, DKK, EUR, GBP, INR, JPY, MXN, NOK, NZD, SAR, SEK, SGD, TRY, USD
event_idNoSTRINGNoUnique identifier for deduplication
partnerConditionalSTRINGNoRequired if event_source is MEASUREMENT_ATTRIBUTION_PARTNER
amazon_ad_event_keyConditionalSTRINGNoRequired if event_source is MEASUREMENT_ATTRIBUTION_PARTNER
Customer Identifier Requirements

At least one customer identifier field (email, phone, first_name, last_name, address, city, state, postal, maid, or match_id) must be provided. Email or phone number is preferred for best matching accuracy.

Specify the Result Export Target

Configure the conversion export settings to send events to Amazon Ads.

  1. Using the Treasure Console, perform steps 1-4 from the "Define your Query" section above.
  2. Select Export Results.
  3. Select the integration you created for Amazon Ads Conversion.

The Export Results modal displays.

Export Results Model Part 1

Export Results Model Part 2

  1. Enter your information into the fields:
FieldDescriptionNote
RegionAmazon Ads API region for your accountRequired. Options: North America (NA), Europe (EU), Far East (FE)
Advertiser IDYour Amazon DSP Advertiser account IDRequired. Found in your Amazon Ads account settings
Dataset NameAmazon dataset identifier (optional)Optional. Used for organizing conversion data in Amazon's system
Custom DataField mappings for custom event dataOptional. Format: field_name: DATA_TYPE (STRING, INTEGER, TIMESTAMP)
Consent TypePrivacy consent framework to useOptional. Options: TCF, GPP, ACS
Skip Invalid RecordsContinue processing when encountering invalid dataOptional. If disabled, job stops on invalid records
Skip Error BatchesContinue processing when batch failsOptional. If disabled, job stops on batch errors
  1. Select Done.

Example Result

************* REPORT *************
2026-04-14 04:34:30.320 +0000 [INFO] (0017:task-0000): ************* REPORT *************
2026-04-14 04:34:30.320 +0000 [INFO] (0017:task-0000): Total records: 1, total skip records: 0, total batches: 1, total skip batches: 0

(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 Treasure Console

  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 ValueDescription
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.

(Optional) Configure Export Results in Workflow

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

_export:
  td:
    database: td.database
   
+ amazon_ads_conversion_export_task:
  td>: export_conversions.sql
  database: ${td.database}
  result_connection: amazon_ads_conversion_auth
  result_settings:
    type: amazon_ads_conversion
    td_authentication_id: td_authentication_id
    region: NA
    advertiser_id: advertiser_id
    dataset_name: conversion_dataset
    custom_data: product_category:STRING,customer_segment:INTEGER
    consent_type: ACS
    amzn_ad_storage: GRANTED
    amzn_user_data: GRANTED
    limited_data_use: false
    skip_invalid_record: true
    skip_error_batch: false

(Optional) Export Integration Using the CLI

You can also use the TD Toolbelt to export conversion events to Amazon Ads using the td query command with the --result option.

The data specified with the --result option is in JSON format:

{
  "type": "amazon_ads_conversion",
  "td_authentication_id": "${authentication_id_from_td_console}",
  "region": "NA",
  "advertiser_id": "your_advertiser_id",
  "dataset_name": "conversion_dataset",
  "custom_data": "product_category:STRING,customer_segment:INTEGER",
  "consent_type": "ACS",
  "amzn_ad_storage": "GRANTED",
  "amzn_user_data": "GRANTED",
  "limited_data_use": false,
  "skip_invalid_record": true,
  "skip_error_batch": false
}

Parameters

NameDescriptionValueDefault ValueRequired
typeThe destination of the export"amazon_ads_conversion"Yes
td_authentication_idThe authentication ID for Amazon Ads authentication in Treasure ConsoleYes
regionAmazon Ads API region"NA", "EU", "FE""NA"Yes
advertiser_idYour Amazon DSP Advertiser account IDYes
dataset_nameAmazon dataset identifierNo
custom_dataCustom field mappings"field_name:DATA_TYPE,field_name2:DATA_TYPE"No
consent_typePrivacy consent framework"TCF", "GPP", "ACS"EmptyNo
tcfTCF consent valueYes if consent_type is "TCF"
gppGPP consent valueYes if consent_type is "GPP"
amzn_ad_storageAmazon ad storage consent"GRANTED", "DENIED"Yes if consent_type is "ACS"
amzn_user_dataAmazon user data consent"GRANTED", "DENIED"Yes if consent_type is "ACS"
limited_data_useEnable limited data use processingtrue, falsefalseNo
skip_invalid_recordContinue processing invalid recordstrue, falsefalseNo
skip_error_batchContinue processing error batchestrue, falsefalseNo

Usage Examples

Manual export:

td query \
--database ${database_name} \
--wait "SELECT * FROM ${conversion_table}" \
--type presto \
--result '{"type":"amazon_ads_conversion","td_authentication_id":"${auth_id}","region":"NA","advertiser_id":"${advertiser_id}","dataset_name":"conversions","skip_invalid_record":true}'

Scheduled export:

td sched:create \
conversions_to_amazon_ads '0 2 * * *' \
--database ${database_name} 'SELECT * FROM ${conversion_table}' \
--result '{"type":"amazon_ads_conversion","td_authentication_id":"${auth_id}","region":"NA","advertiser_id":"${advertiser_id}"}'

Troubleshooting

Common Issues

  • Authentication errors: Verify OAuth permissions include conversion API access
  • Data validation errors: Ensure all required fields are present and at least one customer identifier is provided
  • Hash format errors: Customer PII must be properly normalized and SHA-256 hashed following Amazon's guidelines
  • Rate limiting: Amazon enforces API rate limits; implement appropriate delays between batch uploads
  • Missing customer identifiers: At least one of email, phone, or other PII fields must be provided per event

Error Handling

Error TypeActionRetry
Missing required parametersFix configuration, job failsNo
Invalid data typesFix query, job failsNo
HTTP 4xx errorsCheck API documentation, job failsNo
HTTP 429/5xx errorsJob retries automaticallyYes

External References