Data Manager API Audience Ingestion
Core Directives
- [IMPORTANT] When reading API documentation from developers.google.com, read
the Markdown equivalent of the page by appending to the URL.
Sequential Implementation Workflow
For simple informational, configuration, or setup questions, skip any irrelevant
steps and answer using only the relevant guidelines or documentation provided
below.
Step 1: Identify Use Case & Read Documentation
- Determine Destination Account Type: [CRITICAL] If it's not
explicitly stated, STOP and CLARIFY with the user where the data is being
sent (e.g., Google Ads, Display & Video 360, etc.) BEFORE generating any
code. Do NOT assume Google Ads by default. This maps to the
field of the in the .
- Read Documentation: [CRITICAL] You MUST follow the relevant audience
upload overview for implementation steps:
Step 2: Setup Auth
- Enable API (Prerequisite): Check that the user has enabled the Data
Manager API in their Google Cloud project.
- Generate ADC: Authenticate the local workspace using Application
Default Credentials (ADC) via
gcloud auth application-default login
.
- Required Scopes: Include scopes
https://www.googleapis.com/auth/datamanager
and
https://www.googleapis.com/auth/cloud-platform
.
- Multi-API Scopes: If using the same credentials for other APIs,
append their scopes (e.g.,
https://www.googleapis.com/auth/adwords
).
- Service Accounts: Ensure the Service Account has the
IAM role, and the user executing
has the Token Creator role
(
roles/iam.serviceAccountTokenCreator
) on that Service Account
for impersonation.
- Reference: Refer to Set up API access
for a walkthrough of the CLI auth setup.
Step 3: Install Client Library and Utilities
Refer to
Install a client
library
for detailed installation instructions.
| Language | Installation Instructions |
|---|
| Python | pip install google-ads-datamanager
|
| Java | Follow the quickstart instructions to install the Maven/Gradle dependency. |
| Node | npm install @google-ads/datamanager
|
| PHP | Install the component using Composer. |
| .NET | Install the Google.Ads.DataManager.V1
NuGet package. |
[IMPORTANT] The utility library is NOT available on public package managers
(such as PyPI or Maven). Follow the below instructions to install:
- Clone the repository from GitHub using the commands from the table below.
- Always use the latest available version of the library. Determine the
actual version identifier () from the cloned repository metadata.
- Python: Find the version in
- Java: Find the version in (as the
field).
- Node: Find the version in (as the field).
- Follow the language-specific instructions in the next section to build
and install the utility dependency, replacing with the version
identifier you found.
| Language | Git Clone Command |
|---|
| Python | git clone https://github.com/googleads/data-manager-python.git
|
| Java | git clone https://github.com/googleads/data-manager-java.git
|
| Node | git clone https://github.com/googleads/data-manager-node.git
|
| PHP | git clone https://github.com/googleads/data-manager-php.git
|
| .NET | git clone https://github.com/googleads/data-manager-dotnet.git
|
Install Utility Library
Python
- Navigate to the directory and install the utility
library:
- Declare a dependency in your project's file (replacing
with the identified version):
google-ads-datamanager-util=VERSION
```
Java
- Navigate to the directory.
- Build and publish the utility library to your local Maven repository:
shell
./gradlew data-manager-util:install
-
Declare a dependency on the utility library in your project (replacing
with the identified latest version):
none
implementation 'com.google.api-ads:data-manager-util:VERSION'
xml
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>data-manager-util</artifactId>
<version>VERSION</version>
</dependency>
Node
- Navigate to the directory and install dependencies:
- Navigate to the directory:
- Pack the utility library into a archive:
- Declare a dependency in your Node.js project's pointing to
the path of the generated archive (replacing with the
identified version):
json
{
"dependencies": {
"@google-ads/data-manager-util": "file:/path/to/google-ads-datamanager-util-VERSION.tgz"
}
}
PHP
- Navigate to the directory.
- Resolve dependencies for the library:
shell
composer update --prefer-dist
- Update your project's to declare a dependency on the utility
library using a path repository:
json
{
"repositories": [
{
"type": "path",
"url": "/path/to/cloned/data-manager-php"
}
],
"require": {
"googleads/data-manager-util": "@dev"
}
}
.NET
In your .NET project, declare a
dependency pointing to the
cloned library's
path:
xml
<ProjectReference Include="\path\to\cloned\Google.Ads.DataManager.Util\src\Google.Ads.DataManager.Util.csproj" />
Step 4: Retrieve Code Sample
[IMPORTANT] If writing or updating an ingestion script, ALWAYS retrieve the
relevant code sample to use as a reference:
Step 5: Retrieve migration guides
[CRITICAL] If refactoring code to upgrade from another Google API, ALWAYS
extract the full contents of the relevant field mapping guide.
Google Ads
Display & Video 360
Step 6: Implementation
Implement the ingestion logic using the following checkpoints:
Formatting
-
Fetch the
Format user data
guide and use that as the source of truth for formatting and
normalization rules.
-
Use the utility library to format, hash, and encrypt user data
(emails, phone numbers, addresses).
Python Example:
python
from google.ads.datamanager_util import Formatter
from google.ads.datamanager_util.format import Encoding
formatter: Formatter = Formatter()
processed_email: str = formatter.process_email_address(
email, Encoding.HEX
)
Critical Gotchas
- Do NOT set the field on unless all required
fields are present (, , ,
); incomplete address fields will cause the API request to
fail.
- must be a numeric string. It is NOT a resource
name.
- The enum values for are and
. Do not use the values and .
- Field names on are and . Do
not use the Google Ads API field names and
.
Error Handling & Troubleshooting
Inspecting Error Payloads
[IMPORTANT] Refer to
Understand API Errors
for a detailed guide on how to understand the structure of errors returned by
the API.
API Reference
When implementing or debugging API integrations, use the API reference to lookup
field names, types, and acceptable values. DO NOT guess values.