# Google Data Manager Export Integration This TD export integration lets you send audience data to multiple Google advertising products as Google Adwords, Display Video Partner, Display Video Advertiser with a single call ## Prerequisites - Basic Knowledge of Treasure Data™ - The user OAuth has direct admin access to the target Google Ads or Display Video Partner or Display Video Advertiser account ## Requirements and Limitations ### Limitations - The user list size is displayed as zero until it reaches a minimum of 1,000 members. Beyond this threshold, the size is rounded to the nearest two significant figures - It can take up to 24 hours for a list to be populated with members - It is recommended to append audience data to a user list once per day - Avoid running multiple uploading jobs of the same user list ### Requirements It is recommended to follow Google's [policies](https://support.google.com/adspolicy/answer/6299717) for Customer Match, in particular: - A good history of policy compliance​ - A good payment history. - Upload only customer information that you collected in the first-party context - Restrictions on sensitive categories ## Create a new Connection On TD Console, 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 following the below steps 1. Open **TD Console** 2. Navigate to **Integrations Hub > Catalog** 3. Search for and select **Google Data Manager** 4. Select **Create Authentication**, and provide the credential information for the integration as described below 5. Select **Continue,**enter a name for the Authentication, and select **Done**. ### Authentication Fields - **OAuth Connection** : Authorize from an account having ADMIN access to the target Google Ads or Display Video Partner or Display Video Advertiser account ## Configure a Query Result for Export The TD Console supports multiple ways to export data. Please follow the below 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 ![](/assets/screenshot-2024-05-27-at-13.08.60.c660e2874c5efd5898076c87205c9c1c3579e1232c32206db66443388b0163ee.9c1a955f.png) 1. Select an existing authentication, or create a new one following the above section 2. Configure the exporting parameters as described in the [Configuration Parameters](/int/google-customer-match-export-integration#h2_2111705584) below, and select **Done** ### Define your Query Your query should include the required columns for the target Identifier type, other columns will be ignored. Required columns don't accept a null or empty value (else the record is considered invalid and skipped). **Data requirement:** - Normalization: all plain text data should be in lowercase, and be removed any extra spaces before, and after - SHA-256 hashing: email, phone, first name, and last name should be hashed using the SHA-256 algorithm. If not, they are hashed automatically by the connector | **Column name** | **Description** | Required | | --- | --- | --- | | email (and email_1, email_2, ......., email_n) | Only Google emails are considered in the matching process. Accept multiple fields email with format email_* | At least email field ​or phone field or address field is required for the `User Data` list type. The address field must includes all 4 columns [given_name, family_name, region_code, postal_code]. Phone must follow E.164 format. Visit https://en.wikipedia.org/wiki/E.164 for more detail. Region code must follow https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 An email field or a phone field or an address (given_name, family_name, region_code, postal_code) field is a user identifier. Allow to have at most 10 user identifiers | | phone (and phone_1, phone_2, ......., phone_n) | The [E.164](https://en.wikipedia.org/wiki/E.164) standard is applied Accept multiple fields phone with format phone_* | | | given_name | Address - given name. | | | family_name | Address - family name. | | | region_code | Address - country code (2-letter code in [ISO-3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)) | | | postal_code | Address - postal code | | | mobile_id (and mobile_id_1, mobile_id_2, ......., mobile_id_n) | Identifier for Advertising (IDFA) or Google Advertising ID (AAID) mobile device IDs Accept multiple fields mobile_id with format mobile_id_* | At least mobile_id field is required for the `Mobile Data` list type A mobile_id field is a user identifier. Allow to have at most 10 user identifiers | ### Configuration Parameters | | **Product of Advertiser Account** REQUIRED | string | Google Ads or Display Video Partner or Display Video Advertiser | | --- | --- | --- | | **Mode** REQUIRED | string | The operation mode - **Add**(default): Query results are appended to an existing user list, or a new user list is created, if none exists by the specified List name. - **Remove**: Query results will be removed from an existing user list. | | **Advertiser ID** Required | string | The ID of the target Google Ads account, or DV360 account, with or without dashes | | **List name** REQUIRED | string | Name of the user list | | **List type** REQUIRED | string | Two types of data are supported - **User Data**: upload user profile using email, phone, or address - **Mobile Data**: upload data of a mobile application (IDFA or AAID). | | **List Description** Optional | string | List description use in case create new user list | | **Application ID** OPTIONAL | string | The ID of the mobile application. Require if list type is **Mobile Data** and list name does not exist. | | **Membership days**   OPTIONAL | number | Number of days audience member stays on the user list. The value must be between 0 and 540. Default value: 540 | | **Terms of Service** OPTIONAL | string | The terms of service that the user has accepted/rejected | | **Ad user data** OPTIONAL | string | Uploading data of the users from required regions, such as The European Economic Area, requires an explicit ad consent declaration. | | **Ad personalization** OPTIONAL | string | The consent flag for ad personalization | | **Skip invalid records** OPTIONAL | boolean | Default: true | ## 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**. ## (Optional) Export Integration Using the workflow Within Treasure Workflow, you can specify the use of a data connector to export data. Learn more at [Using Workflows to Export Data with the TD Toolbelt](https://api-docs.treasuredata.com/en/tools/cli/api/#workflow-commands). ``` _export: td: database: google_data_manager+google_data_manager_export_task: td>: export.sql database: ${td.database} result_connection: new_created_google_data_manager result_settings: type: google_data_manager product: GOOGLE_ADS mode: add advertiser_id: 123456789 list_name: test list_description: desc list_type: mobile_data app_id: app_id membership_life_span: 100 terms_of_service: ACCEPTED ad_user_data: CONSENT_GRANTED ad_personalization: CONSENT_GRANTED skip_invalid_records:true _export: td: database: google_data_manager+google_data_manager_export_task: td>: export.sql database: ${td.database} result_connection: new_created_google_data_manager result_settings: type: google_data_manager product: GOOGLE_ADS mode: remove advertiser_id: 123456789 list_name: test list_type: user_data skip_invalid_records:true ``` ## (Optional) Export Integration Using the CLI You can also use CLI (Toolbelt) to export results to Google Platform. You need to specify the information for export to your Google Account 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. Add mobile data ``` type: google_data_manager product: GOOGLE_ADS mode: add advertiser_id: 123456789 list_name: test list_description: desc list_type: mobile_data app_id: app_id membership_life_span: 100 terms_of_service: ACCEPTED ad_user_data: CONSENT_GRANTED ad_personalization: CONSENT_GRANTED skip_invalid_records:true ``` Add user data ``` type: google_data_manager product: GOOGLE_ADS mode: add advertiser_id: 123456789 list_name: test list_description: desc list_type: user_data membership_life_span: 100 terms_of_service: ACCEPTED ad_user_data: CONSENT_GRANTED ad_personalization: CONSENT_GRANTED skip_invalid_records:true ``` Remove user data/mobile data ``` type: google_data_manager product: GOOGLE_ADS mode: remove advertiser_id: 123456789 list_name: test list_type: user_data skip_invalid_records:true ``` ### ### Parameters | Name | Description | Value | Default Value | Required | | --- | --- | --- | --- | --- | | type | connector type | google_data_manager | N/A | Yes | | oauth_credentials_id | Credential id that was created by authentication method OAuth on the console | N/A | N/A | Yes | | product | Product of Advertiser Account | Supported: - GOOGLE_ADS - DISPLAY_VIDEO_PARTNER - DISPLAY_VIDEO_ADVERTISER | GOOGLE_ADS | Yes | | mode | | Supported: - ADD - REMOVE | ADD | Yes | | advertiser_id | Advertiser ID | N/A | N/A | Yes | | list_name | List Name | N/A | N/A | Yes | | list_description | | N/A | N/A | No | | list_type | Choose [User Data] to upload data type such as email, phone or address Choose [Mobile Data] to upload data type such as (IDFA or AAID) | Supported: - user_data - mobile_data | user_data | Yes | | app_id | Application ID | N/A | N/A | Yes if list type is mobile_data and list name does not exist. | | membership_life_span | Number of days audience member stays on the user list. The value must be between 0 and 540 | [0-540] | 540 | No | | terms_of_service | The terms of service that the user has accepted/rejected | Supported: - TERMS_OF_SERVICE_STATUS_UNSPECIFIED - ACCEPTED - REJECTED | ACCEPTED | No | | ad_user_data | | Supported: - CONSENT_STATUS_UNSPECIFIED - CONSENT_GRANTED - CONSENT_DENIED | CONSENT_GRANTED | No | | ad_personalization | | Supported: - CONSENT_STATUS_UNSPECIFIED - CONSENT_GRANTED - CONSENT_DENIED | CONSENT_GRANTED | 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 ``` $ td query --result '{"type":"google_data_manager","oauth_credentials_id":"xxx","product":"GOOGLE_ADS","mode":"add","advertiser_id":"xxx","list_name":"xxx","list_description":"xxx","list_type":"user_data","membership_life_span":540,"terms_of_service":"ACCEPTED","ad_user_data":"CONSENT_GRANTED","ad_personalization":"CONSENT_GRANTED","skip_invalid_records":true}' -d sample_datasets "select ........ from ........" -T presto ``` ## Others - You can use [Scheduled Job](https://docs.treasuredata.com/articles/pd/scheduling-jobs-using-td-console)  with Result Export to periodically upload data to a target destination