# Google Data Manager v2 Export Integration

The Google Data Manager v2 export connector sends audience data from Treasure AI to Google advertising products through the [Google Data Manager API](https://developers.google.com/data-manager/api). With one connector you can add members to, remove members from, or fully replace the members of a user list in Google Ads, Display & Video 360 (partner or advertiser), or Google Ad Manager. If the user list does not exist, the connector creates it.

The connector supports three list types: user data (email, phone, or address), mobile data (mobile advertising IDs), and PPID data (publisher provided identifiers for Google Ad Manager). Email, phone, and name values are SHA-256 hashed automatically.

Version 2 calls only the Google Data Manager API. The earlier connector, [Google Data Manager Export Integration](/int/google-data-manager-export-integration), still uses the Google Audience Partner API for the partner link and user list calls. Google sunsets that API in March 2027, after which version 2 is the only version.

## Prerequisites

- Basic knowledge of Treasure AI.
- A Google account with admin access to the target Google Ads, Display & Video 360 partner, Display & Video 360 advertiser, or Google Ad Manager account.
- The ID of the target account. For a Google Ad Manager PPID list, this is the Google Ad Manager network code.


## Limitations and Known Issues

- Each audience member can have at most **10 identifiers** (emails, phone numbers, and complete addresses combined for user data, or mobile IDs for mobile data). A record over the limit is invalid.
- The connector sends at most **10,000 audience members per request** and splits larger results into multiple requests.
- Identifier columns must be of type `string`. The job fails before sending any data if an identifier column has another type.
- Column names must be unique, ignoring case and surrounding whitespace.
- An existing user list must match the configured **list type**. For mobile data, the list's app ID must also match the configured **app ID**. Otherwise the job fails.
- If more than one user list has the same name in the target account, the job fails. Use unique list names.
- The `PPID_DATA` list type is available only when the account type is `GOOGLE_AD_MANAGER`.
- Google needs about 30 minutes before the status of an upload request is available. In `REPLACE` mode, the connector waits for the remove-all request on an existing list to finish before it uploads, so the job takes at least that long.
- `REPLACE` mode does not clear the list when the query returns no rows, because the connector clears the list only when it has data to upload. The job succeeds and the list stays unchanged.
- `REPLACE` is not atomic. If the removal succeeds and a later upload fails, the list stays empty or partly filled until the next successful run.
- Google Customer Match audiences need at least 100 members to be eligible for targeting. After `REPLACE` removes all members, the list can be below that minimum until Google processes the upload.
- The user list name match is exact and case-sensitive. `My List` and `my list` are different lists. Another casing creates a new list in `ADD` and `REPLACE` modes and fails in `REMOVE` mode.
- An address identifier uses only given name, family name, region code, and postal code.
- Google can accept an upload request partially. When some audience members are rejected, Google reports the request as `PARTIAL_SUCCESS` with the reasons and the affected record indices. Set **Waiting for Request Status** to see these details in the job log.
- The authenticated user must have an admin role on the operating account or on its manager account.


## Authentication and Partner Link

You authenticate with an OAuth connection to a Google account that has admin access to the target account.
Before it uploads any data, the connector links the target account to the Treasure AI data partner in Google Data Manager V2, using your credential. If the link already exists, the connector continues. You do not need to create the link yourself.

The credential decides whether you set a linked account:

- If the OAuth credential belongs to the operating account itself, leave **Linked Account ID** empty. The operating account owns the partner link.
- If the OAuth credential belongs to the parent manager account of the operating account, set **Linked Account ID** to the ID of that manager account. The manager account owns the partner link, and the connector reaches the operating account through it.


The linked account always has the same account type as the operating account, including a Display & Video 360 advertiser whose parent is a Display & Video 360 partner.

## Create a New Connection and Export from the Treasure Console

1. Open **Treasure Console**.
2. Navigate to **Integrations Hub** > **Catalog**.
3. Search for and select **Google Data Manager V2**. Select **Create Authentication**.


![](/assets/logo.75d352055be72f9eb184ca125e30b2eb5b4083e97a00a89f2828ece639b3804b.7109776e.webp)

1. Select the credentials to authenticate.


![](/assets/new_connector.f7a236f6ccee850c3fc756940c521cf4ab73e6e354836f383ea215d785e71d03.7109776e.webp)

1. Optionally, select **Sign in with Google** and log in to Google.
2. Return to **Integrations Hub** > **Catalog**.
3. Search for and select **Google Data Manager V2**.
4. The New Authentication dialog opens.
5. Select the OAuth connection with your account name in the dropdown list.
6. Select **Continue**.
7. Name the connection.
8. Select **Done**.


To export a query result:

1. Navigate to **Data Workbench** > **Queries**.
2. Select **New Query** and define your query.
3. Select **Export Results**.
4. Select an existing Google Data Manager V2 authentication or create a new one as described previously.
5. Configure the parameters in the next section, and select **Done**.


## Configuration Parameters

The Treasure Console shows each parameter as a field with a title-case label, for example **Operating Account ID** for `operating_account_id`. In `REMOVE` mode the list must already exist. Some fields appear only for certain choices: **Application ID** and **Mobile Key Space** appear when **List Type** is Mobile Data.

| Parameter  | Description  | Required  | Default  |
|  --- | --- | --- | --- |
| `account_type` | The type of the target Google account. Accepted values:- `GOOGLE_ADS`
- `DISPLAY_VIDEO_PARTNER`
- `DISPLAY_VIDEO_ADVERTISER`
- `GOOGLE_AD_MANAGER`

 | No | `GOOGLE_ADS` |
| `operating_account_id` | The ID of the account that owns the user list, with or without dashes. Numeric values only. For a `PPID_DATA` list, enter the Google Ad Manager network code. | Yes |  |
| `linked_account_id` | The ID of the linked account, with or without dashes. Set it when the operating account is managed through a linked account. Numeric values only. | No |  |
| `mode` | The operation. `ADD` adds members to the list. `REMOVE` removes members from the list. `REPLACE` removes all current members, waits for the removal to finish, and then uploads the query result. | No | `ADD` |
| `list_name` | The name of the user list. If no list has this name, the connector creates it (not in `REMOVE` mode). | Yes |  |
| `list_type` | The type of data to upload. Accepted values:- `USER_DATA`: email, phone, and address.
- `MOBILE_DATA`: mobile advertising IDs.
- `PPID_DATA`: publisher provided IDs. Requires `account_type` `GOOGLE_AD_MANAGER`.

 | No | `USER_DATA` |
| `list_description` | The description of a new user list. Ignored when the list already exists. | No |  |
| `app_id` | The ID of the mobile app. Required for `MOBILE_DATA`. For an existing list, it must match the app ID of the list. | Yes for `MOBILE_DATA` |  |
| `mobile_key_space` | The platform of the mobile app: `IOS` or `ANDROID`. | Yes for `MOBILE_DATA` |  |
| `membership_duration` | The number of days a member stays on a new list. Must be between 1 and 540. Applies only when the connector creates the list. | No | `540` |
| `terms_of_service` | The terms of service status sent with the upload. Accepted values: `TERMS_OF_SERVICE_STATUS_UNSPECIFIED`, `ACCEPTED`, `REJECTED`. Required by Google for Customer Match lists (`USER_DATA` and `MOBILE_DATA`). Not required, and not sent, for `PPID_DATA`. Sent in `ADD` and `REPLACE` modes. | No | `ACCEPTED` |
| `ad_user_data` | The consent status for sending user data to Google. Accepted values: `CONSENT_STATUS_UNSPECIFIED`, `CONSENT_GRANTED`, `CONSENT_DENIED`. Sent with every upload request, in every mode and for every list type. Google treats consent as optional in the API, but recommends it for members in regulated regions such as the European Economic Area (EEA) and the UK, so that Google can process the identifiers for ad personalization. | No | `CONSENT_GRANTED` |
| `ad_personalization` | The consent status for ad personalization. Accepted values: `CONSENT_STATUS_UNSPECIFIED`, `CONSENT_GRANTED`, `CONSENT_DENIED`. Sent with every upload request, in every mode and for every list type. Google treats consent as optional in the API, but recommends it for members in the EEA and the UK. | No | `CONSENT_GRANTED` |
| `skip_invalid_records` | When `true`, the connector skips invalid records, counts them, and continues. When `false`, the job stops at the first invalid record. | No | `true` |
| `waiting_for_request_status` | When `true`, after the last upload the connector waits for the final status of every upload request and writes it to the job log. The job succeeds regardless of the statuses. The wait can keep the job running for up to 24 hours. | No | `false` |


## Query Data Specifications

The columns in your query determine the identifiers sent to Google. The connector reads only the columns that match the selected list type and ignores all others.

### Column Naming

- Name a column `<field>` or `<field>_N`, where `N` is a number (for example `email`, `email_1`, `email_2`). Matching ignores case and surrounding whitespace.
- A column that starts with an identifier name but does not follow this pattern (for example `email2`) is ignored, and the job log lists it as a warning.
- All identifier columns must be of type `string`.
- Columns with `NULL` or blank values are skipped for that record.
- Duplicate column names are not allowed.


### User Data (`USER_DATA`)

A record needs at least one email, one phone number, or one complete address.

| Column  | Description  | Normalization and hashing  |
|  --- | --- | --- |
| `email`, `email_1`, `email_2`, ... | Email address. Each column adds one identifier. | Normalize then SHA-256 hashed. A 64-character hexadecimal value is sent as is. |
| `phone`, `phone_1`, `phone_2`, ... | Phone number in E.164 format, for example `+14155550101`. Each column adds one identifier. | Trimmed, then SHA-256 hashed. The connector does not reformat the number. A 64-character hexadecimal value is sent as is. |
| `given_name`, `given_name_1`, ... | First name of an address identifier. | Trimmed, lowercased, and stripped of punctuation, then SHA-256 hashed. |
| `family_name`, `family_name_1`, ... | Last name of an address identifier. | Trimmed, lowercased, and stripped of punctuation, then SHA-256 hashed. |
| `region_code`, `region_code_1`, ... | Country of an address identifier, as a two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code. | Uppercased, and only the first two characters are sent. Not hashed. |
| `postal_code`, `postal_code_1`, ... | Postal code of an address identifier. | Trimmed. Not hashed. |


An address identifier is made of `given_name`, `family_name`, `region_code`, and `postal_code` columns that share the **same suffix**. For example, `given_name_1`, `family_name_1`, `region_code_1`, and `postal_code_1` form one address, and `given_name`, `family_name`, `region_code`, and `postal_code` (no suffix) form another. The connector drops an address that is missing any of the four fields and keeps the record's other identifiers. If the record then has no identifier left, the record is invalid.

Each email, phone number, and complete address counts as one identifier. A record can have at most 10.

### Mobile Data (`MOBILE_DATA`)

| Column  | Description  | Notes  |
|  --- | --- | --- |
| `mobile_id`, `mobile_id_1`, `mobile_id_2`, ... | Mobile advertising ID. | Trimmed. Not hashed. At least one value is required, and a record can have at most 10. |


For an iOS list, enter the numeric App Store track ID as the **app ID** (for example `123456789`), not the bundle identifier. For an Android list, enter the Google Play package name (for example `com.example.app`).

### PPID Data (`PPID_DATA`)

| Column  | Description  | Notes  |
|  --- | --- | --- |
| `ppid`, `ppid_1`, `ppid_2`, ... | Publisher provided identifier. | Trimmed. Not hashed. At least one value is required. |


### Invalid Records

A record is invalid when it has no usable identifier or has more than 10 identifiers. With `skip_invalid_records` set to `true`, the connector skips the record, counts it, and logs the reason for the first 100 invalid records. With `false`, the job fails at the first invalid record.

### Example Queries

User data:

```sql
SELECT
    email,
    email AS email_1,
    phone,
    given_name,
    family_name,
    region_code,
    postal_code
FROM customers
```

Mobile data:

```sql
SELECT
    mobile_id
FROM mobile_devices
```

PPID data:

```sql
SELECT
    ppid
FROM publisher_ids
```

### (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.
![](/assets/image2021-1-15_17-28-51.f1b242f6ecc7666a0097fdf37edd1682786ec11ef80eff68c66f091bc405c371.0f87d8d4.png)
4. In the drop-down, select one of the following schedule options:
![](/assets/image2021-1-15_17-29-47.45289a1c99256f125f4d887e501e204ed61f02223fde0927af5f425a89ace0c0.0f87d8d4.png)
| Drop-down Value | Description |
|  --- | --- |
| Custom cron... | Review [Custom cron... details](#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. |
| None | No schedule. |


#### Custom cron... Details

![](/assets/image2021-1-15_17-30-23.0f94a8aa5f75ea03e3fec0c25b0640cd59ee48d1804a83701e5f2372deae466c.0f87d8d4.png)

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

## 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**.


If you need to create an activation for a batch journey, review [Creating a Batch Journey Activation](/products/customer-data-platform/journey-orchestration/batch/creating-a-batch-journey-activation).

## How the Connector Uploads Data

1. The connector validates the configuration and the query schema.
2. It creates the partner link, or continues if the link exists.
3. It looks up the user list by `list_name`. If no list exists, it creates one (not in `REMOVE` mode, where a missing list fails the job).
4. In `REPLACE` mode on an existing list, it removes all members and waits for the request to finish.
5. It uploads the query result in batches of up to 10,000 members.
6. If `waiting_for_request_status` is `true`, it waits for the final status of each request and logs it.


## (Optional) Export Integration Using the CLI

You can run the export from the command line with [`tdx job submit`](/treasure-code/commands/job) and the `--result` option. The value is a JSON object with the connector parameters described in Configuration Parameters, plus the following two:

| Parameter | Description | Required |
|  --- | --- | --- |
| `type` | The connector type. Set it to `google_data_manager_v2`. | Yes |
| `td_authentication_id` | The ID of the Google Data Manager V2 authentication that you created on the Treasure Console. | Yes |


Add user data to a user list:

```bash
tdx job submit "SELECT email, phone, given_name, family_name, region_code, postal_code FROM customers" \
  --database my_database \
  --result '{"type":"google_data_manager_v2","td_authentication_id":12345,"account_type":"GOOGLE_ADS","operating_account_id":"1234567890","mode":"ADD","list_name":"my_user_list","list_type":"USER_DATA","list_description":"Customers from Treasure AI","membership_duration":540,"skip_invalid_records":true}'
```

Replace the members of a mobile data list, with a linked manager account:

```bash
tdx job submit "SELECT mobile_id FROM mobile_devices" \
  --database my_database \
  --result '{"type":"google_data_manager_v2","td_authentication_id":12345,"account_type":"GOOGLE_ADS","operating_account_id":"1234567890","linked_account_id":"9876543210","mode":"REPLACE","list_name":"my_mobile_list","list_type":"MOBILE_DATA","app_id":"com.example.app","mobile_key_space":"ANDROID"}'
```

Add PPIDs to a Google Ad Manager list. `operating_account_id` is the Google Ad Manager network code:

```bash
tdx job submit "SELECT ppid FROM publisher_ids" \
  --database my_database \
  --result '{"type":"google_data_manager_v2","td_authentication_id":12345,"account_type":"GOOGLE_AD_MANAGER","operating_account_id":"12345678","mode":"ADD","list_name":"my_ppid_list","list_type":"PPID_DATA"}'
```

Remove members from a user list:

```bash
tdx job submit "SELECT email FROM unsubscribed_customers" \
  --database my_database \
  --result '{"type":"google_data_manager_v2","td_authentication_id":12345,"account_type":"GOOGLE_ADS","operating_account_id":"1234567890","mode":"REMOVE","list_name":"my_user_list","list_type":"USER_DATA"}'
```

## (Optional) Export Integration Using a Workflow

Within Treasure Workflow, you can run the export as a `td>` task with a result connection. Create the connection on the Treasure Console, then reference its name in `result_connection`. Learn more at [Using Workflows to Export Data](/tools/cli-and-sdks/api#workflow-commands).

```yaml
_export:
  td:
    database: my_database

+google_data_manager_v2_export_task:
  td>: export.sql
  database: ${td.database}
  result_connection: my_google_data_manager_v2_connection
  result_settings:
    type: google_data_manager_v2
    account_type: GOOGLE_ADS
    operating_account_id: "1234567890"
    mode: ADD
    list_name: my_user_list
    list_type: USER_DATA
    list_description: Customers from Treasure AI
    membership_duration: 540
    waiting_for_request_status: false
    skip_invalid_records: true
```

To replace the content of the list on every run, set `mode: REPLACE`. To remove members, set `mode: REMOVE`.