The Amazon Marketing Cloud (AMC) app integration allows advertisers using Amazon Advertising to pass CDP segments of advertiser audiences from Treasure Data (TD) in pseudonymized form. AMC combines Amazon Ads signals across advertising channels to provide custom analytics on topics such as media impact, audience segments, and customer journeys while maintaining customer privacy.
Audience overlap: Understand the overlap between Treasure Data audiences and those engaged with their Amazon Ads campaigns.
Audience attributes: Assess the Amazon audience segments that contains your Treasure Data audiences.
Off-Amazon ad impact: Measure the impact of Amazon Ads campaigns on direct-to-customer engagements and conversions.
Customer journey: Evaluate customer activities across Amazon Ads channels as well as brand-owned channels such as email and website.
Ensure that the Amazon Marketing Cloud Segment Enrichment app package is enabled in the TD Marketplace within your tenant.
You have an existing Audience and Segment within Treasure Data.
You have an existing Amazon Marketing Cloud instance.
Configured a connection between your Amazon Marketing Cloud instance and Treasure Data instance. For details, visit Amazon DSP Data Provider Export Integration.
Currently, the Amazon DSP Export Integration has limitations in fully supporting the AMC app. For example, Amazon DSP does not accept hashed emails and can only accept cookies.
- To use Treasure Insights Dashboards created by AMC:
- TD Account must have Treasure Insights enabled.
- TD User installing the package must have Edit Data Models & Dashboards permissions.
- TD User installing the package must have Workflow Edit & Run permissions.
To allow-list to your Amazon Marketing Cloud instance with Treasure Data CDP, you must contact your Amazon Advertising Account Executive, or send a request to AMC Support with your Amazon Marketing Cloud instance ID and confirm that you would like to connect to Treasure Data CDP. After this request is successfully processed, Treasure Data CDP can connect to your Amazon Marketing Cloud instance on a recurring basis.
By filing this submission, you will be replacing access for any existing connections to your Amazon Marketing Cloud instance using an allow-list method. If you have questions about this, contact your TD Account Executive or Amazon Marketing Cloud Support.

API Key: A master API key from your Treasure Data Account.
API Endpoint: A specific endpoint for you TD instance. For example, api.treasuredata.com, which can be obtained at endpoints.
Email to Assign Datamodels To: Initial owner to assign data model access for Insights Models created by the app.

Audience Id: ID of the Audience.
Segment Id: ID of the segment within the audience.
Cdp Endpoint: The API endpoint of your CDP instance, which can be found here at endpoints.


- Amazon Marketing Cloud Instance Endpoint: (Provided by your Amazon Marketing Cloud rep) For example:
https://xxxxxxx.execute-api.us-east-1.amazonaws.com/prod
Data Upload AWS Account ID: The ID of the Amazon Marketing Cloud Instance’s data upload AWS account. This can be provided by your Account Executive or Amazon Marketing Cloud support.
You may refer to the following screenshot for an example of where to find the required IDs in the Amazon Marketing Cloud UI:
The Amazon Marketing Cloud instance ID is found in the URL (highlighted).
The Amazon Marketing Cloud API endpoint and Data Upload AWS Account ID are found in the Tasks section.

After the app has completed installation, the following components are installed.
amc_upload_db.amc_log_table: Stores event logs from interactions with Amazon Marketing Cloud API.
amc_upload_db.amc_upload_segment_segment_id: Segments exported to Amazon Marketing Cloud are stored in this database with the the naming convention
amc_upload_segment_segment_segment_id. For example, segment id 12345 would be a tableamc_upload_segment_12345in the databaseamc_upload_db.amc_results_db.queryname_segment_segment_id: Results from Amazon Marketing Cloud workflows are stored in this database with the the naming convention
queryname_segment_<segment_id>. For example, segment id12345and query / workflow nameoverall_1p_user_matchwould be a tableoverall_1p_user_match_segment_157460in the databaseamc_upload_db.
amc_results_db.segment_matchrate: Stores matchrate of uploaded segments.
queries/amc_log_table_check_logs.sql: Check logs of app events.
queries/check_s3_to_amc_upload_status.sql: Check status of uploads from s3 to Amazon Marketing Cloud instance.
queries/check_workflowExecutionId.sql: Check status of workflow executions.
amc_marketplace_app_v1.dig: Main workflow that starts steps to get segment information and creates dataset on Amazon Marketing Cloud.
amc_run_adhoc_query.dig: Run adhoc query or workflow on Amazon Marketing Cloud.
get_s3_to_amc_upload_status.dig: Runs every 30 minutes using query
queries/check_s3_to_amc_upload_status.sqlto check status of uploads of segment information from S3 to Amazon Marketing Cloud instance. If successful upload ID is found, workflow is created and executed on Amazon Marketing Cloud and aworkflowExecutionIdis saved.get_workflow_status.dig: Runs every 30 mins using
queries/check_workflowExecutionId.sqlto check status of workflow executions based onworkflowExecutionId. IfworkflowExecutionIdstatus is succeeded and results contain data, results will be uploaded intoamc_results_db databasewith the naming convention<workflow_id>_segment_<segment_id>. Insights Datamodel will be created with a naming conventionamc_workflowId_segment_<segmentId>. For example, workflowsbx_dsp_impressionsand segment157460would create datamodelamc_sbx_dsp_impressions_segment_157460.
The Amazon Marketing Cloud marketplace package only uploads hashed emails for matching with Amazon Marketing Cloud. Ensure that your segments include an email field. This gets hashed by the AMC Segment Enrichment app.
Get the Audience and Segment ID of the segment that you would like to upload to Amazon Marketing Cloud. You can get these from viewing the segment URL in Audience Studio v5. For example: https://console-next.treasuredata.com/app/ps/252594/e/157460/sb/da. In this instance, the Audience ID is the number after
ps: 252594 and the segment ID is after/e/: 157460.
Open the
amc_marketplace_app_v1.digworkflow.Modify the
config.ymlfile to insert theaudienceIdandsegmentIdof the segment you would like to upload.
Run the
amc_marketplace_app_v1.digworkflow.When the workflow ends,
uploadIdwill be visible in the logs.
The
get_s3_to_amc_upload_status.digruns every 30 mins to update the status of uploads of datasets / 1p data to Amazon Marketing Cloud.You can check the upload ID using the
queries/check_s3_to_amc_upload_status.sqlquery to check the status of the upload.
You can confirm the data is uploaded to your Amazon Marketing Cloud instance by checking under the Advertiser Uploaded section for the uploaded data.

Edit the
amc_run_adhoc_query.digfile.Edit the following parameters: dataSetId: segment_$​{segment_id}
- **dataSetId:** segment_${segment_id}
- ${segment_id} value is found in the `config.yml` file.
- **queryName:** overall_1p_conversion
- Select the query name for the query you would like to run from the list of queries in the `sample_queries.yml` file.
- **Query:** ${overall_1p_conversion}
- Enter the queryname between the ${xxxx}.
- **timeWindowStart:** "2022-09-05T00:00:00"
- The start time of the time window period.
- **timeWindowEnd:** "2022-09-14T00:00:00"
- The end time of the time window period.
- **timeWindowType:** 'EXPLICIT'
- Specifies the label for time window period as predefined by AMC API. For details, refer to Amazon API documentation.
- **timeWindowTimeZone:** 'UTC'
- The time zone.When you have edited the parameters as required, save and commit the
amc_run_adhoc_query.digfile.Run the
amc_run_adhoc_query.digfile.Logs for workflow run should end with the pending status of workflow and the parameters should match those entered in previous step.

Workflow run logs will include
workflowExecutionId. For example,20ba9649-08fc-4daa-8dd4-bfd95b595bf3.Your Amazon Marketing Cloud workflow is now in
PENDINGstatus.The
get_workflow_status.digworkflow runs every 30 mins to check and update the status ofworkflowExecutionId.You can run the
queries/check_workflowExecutionId.sqlquery to check if the app has any pendingworkflowExecutionId.

- When the
get_workflow_status.digworkflow runs, it checks the status of theworkflowExecutionId. When workflow completes, the data is uploaded into the databaseamc_results_dbwith table named with the conventionqueryname_segment_<segment_id>.

- When workflow execution completes, a datamodel is created with a naming convention
amc_queryname_segment_<segment_id>.

- The results from the Amazon Marketing Cloud workflows are loaded into tables in the
amc_results_dbdatabase with table named with the convention<queryname_segment_<segment_id>.

- Datamodels from workflow results are created with the naming convention
amc_queryname_segment_<segment_id>.
![insights_models_results] (./img/insights_models_results.jpg)