1
---
2
name: data-manager-api-event-ingestion
3
description: >-
4
Guides developers through implementing event and conversion ingestion to
5
Google products using the Data Manager API /v1/events:ingest endpoint
6
and its associated client libraries. Use this skill when the user wants to upload
7
offline conversions, enhanced conversions for leads, click conversions, call
8
conversions, Google Analytics web or app events, or any other event ingestion
9
use case supported by the Data Manager API. Don't use for uploading audience
10
members (use the data-manager-api-audience-ingestion skill), or for debugging
11
errors, checking request status, or investigating missing conversions (use
12
the data-manager-api-troubleshooting skill).
13
metadata:
14
version: "1.3.1"
15
category: GoogleAds
16
---
17
# Data Manager API Event Ingestion
18
19
## Implementation Workflow
20
21
### Prerequisites
22
23
- **Authentication & Library Installation**: If you need to set up access to
24
the Data Manager API or install the client and utility libraries, refer to
25
the `data-manager-api-setup` skill.
26
27
### Step 1: Identify Use Case & Read Documentation
28
29
- **Determine Destination Account Type**: [CRITICAL] If it can't be determined
30
from the user's context, consider clarifying which destination events are
31
being ingested to before generating any code. This maps to the
32
`account_type` field of the `operating_account` in the `Destination`,
33
and also determines valid event identifiers and requirements.
34
- **Identify User Intent**:
35
- **Answering questions about requirements or implementing ingestion
36
code**: Retrieve the full contents of the relevant implementation guide
37
for the destination and use case in the **Implementation guide** column
38
below before answering or writing code. Use its **Event field
39
requirements**, **Identifier requirements**, and **How Google handles
40
multi-source data** sections as the source of truth for destination
41
configuration, event and identifier requirements, and deduplication or
42
update behavior.
43
- **Checking request status or inspecting errors**: Use the
44
`data-manager-api-troubleshooting` skill.
45
- **Migrating from another Google API**: Refer to
46
[Step 3: Retrieve Migration Guides](#step-3-retrieve-migration-guides)
47
below to extract the full contents of the relevant field mapping guide.
48
49
| Destination (`operating_account.account_type`) | Use case | Implementation guide |
50
| :--- | :--- | :--- |
51
| **Google Ads** (`GOOGLE_ADS`) | Offline conversions, enhanced conversions for leads | [Send events](https://developers.google.com/data-manager/api/devguides/events/google-ads/offline/send-events.md.txt) |
52
| **Google Ads** (`GOOGLE_ADS`) | Multi-source conversions supplementing the Google tag | [Send events](https://developers.google.com/data-manager/api/devguides/events/google-ads/online/send-events.md.txt) |
53
| **Google Ads** (`GOOGLE_ADS`) | Store sales conversions | [Send events](https://developers.google.com/data-manager/api/devguides/events/google-ads/store-sales/send-events.md.txt) |
54
| **Google Ads** (`GOOGLE_ADS`) | Call conversions | [Send events](https://developers.google.com/data-manager/api/devguides/events/google-ads/call/send-events.md.txt) |
55
| **Google Analytics** (`GOOGLE_ANALYTICS_PROPERTY`) | Recommended and custom GA4 events | [Send events](https://developers.google.com/data-manager/api/devguides/events/analytics/recommended-custom-events/send-events.md.txt) |
56
| **Google Analytics** (`GOOGLE_ANALYTICS_PROPERTY`) | Multi-source events with a transaction ID | [Send events](https://developers.google.com/data-manager/api/devguides/events/analytics/online/send-events.md.txt) |
57
| **Floodlight** (`FLOODLIGHT_CONFIG`) | Floodlight offline conversions | [Send events](https://developers.google.com/data-manager/api/devguides/events/cm360/offline/send-events.md.txt) |
58
| **Floodlight** (`FLOODLIGHT_CONFIG`) | Multi-source conversions supplementing the Google or Floodlight tag | [Send events](https://developers.google.com/data-manager/api/devguides/events/cm360/online/send-events.md.txt) |
59
60
If the request doesn't match any row, fetch the
61
[Events overview](https://developers.google.com/data-manager/api/devguides/events.md.txt)
62
to find the right guide rather than guessing.
63
64
### Step 2: Retrieve Code Sample
65
66
> [!IMPORTANT]
67
> If writing or updating an ingestion script, ALWAYS retrieve the
68
> relevant code sample to use as a reference:
69
70
| Language | Sample |
71
| :--- | :--- |
72
| **Python** | [`ingest_events.py`](https://github.com/googleads/data-manager-python/blob/main/samples/events/ingest_events.py) |
73
| **Java** | [`IngestEvents.java`](https://github.com/googleads/data-manager-java/blob/main/data-manager-samples/src/main/java/com/google/ads/datamanager/samples/IngestEvents.java) |
74
| **PHP** | [`ingest_events.php`](https://github.com/googleads/data-manager-php/blob/main/samples/events/ingest_events.php) |
75
| **Node** | [`ingest_events.ts`](https://github.com/googleads/data-manager-node/blob/main/samples/events/ingest_events.ts) |
76
| **.NET**| [`IngestEvents.cs`](https://github.com/googleads/data-manager-dotnet/blob/main/samples/IngestEvents.cs) |
77
78
### Step 3: Retrieve Migration Guides
79
80
> [!IMPORTANT]
81
> If refactoring code to upgrade from another Google API, ALWAYS
82
> extract the full contents of the relevant field mapping guide.
83
84
#### Google Ads
85
86
* **Offline conversions, enhanced conversions for leads** (migrating from the
87
Google Ads API):
88
[Google Ads Offline Conversions Migration Field Mappings](https://developers.google.com/data-manager/api/devguides/events/google-ads/offline/upgrade/field-mappings.md.txt)
89
* **Store sales conversions** (migrating from the Google Ads API):
90
[Google Ads Store Sales Migration Field Mappings](https://developers.google.com/data-manager/api/devguides/events/google-ads/store-sales/upgrade/field-mappings.md.txt)
91
* **Call conversions** (migrating from the Google Ads API):
92
[Google Ads Call Conversions Migration Field Mappings](https://developers.google.com/data-manager/api/devguides/events/google-ads/call/upgrade/field-mappings.md.txt)
93
94
#### Google Analytics
95
96
* **Recommended and custom GA4 events** (migrating from the Google Analytics
97
Measurement Protocol):
98
[Google Analytics Measurement Protocol Migration Field Mappings](https://developers.google.com/data-manager/api/devguides/events/analytics/measurement-protocol/upgrade/field-mappings.md.txt)
99
100
#### Floodlight
101
102
* **Floodlight offline conversions** (migrating from the Campaign Manager 360
103
API):
104
[Campaign Manager 360 Offline Conversions Migration Field Mappings](https://developers.google.com/data-manager/api/devguides/events/cm360/offline/upgrade/field-mappings.md.txt)
105
106
### Step 4: Implementation
107
108
Implement the ingestion logic using the following checkpoints:
109
110
- [ ] **Initialize Client**: Instantiate the Data Manager client
111
(`IngestionServiceClient`).
112
- [ ] **Define Destinations**: Build the `Destination` object using the
113
`product_destination_id` and the appropriate account configurations:
114
`operating_account` (target account receiving data), `login_account` (if
115
authenticating using a manager account or a data partner account), and
116
`linked_account` (if you're a data partner accessing the account via a
117
partner link to a manager account). The Data Manager API does not support
118
sending events to Floodlight or Google Analytics destinations using a linked
119
data partner. **STRONGLY RECOMMENDED**: Refer to the
120
[Configure destinations and headers](https://developers.google.com/data-manager/api/devguides/concepts/destinations.md.txt)
121
guide for more details on configuring destinations.
122
- [ ] **Prepare Event Data**: Use the utility library helpers to format and
123
normalize user identifiers correctly.
124
- [ ] **Construct Payload**: Build the request payload
125
(`IngestEventsRequest`) containing the destinations, event records,
126
consent permissions, and `encoding` (`HEX` or `BASE64`, matching the
127
encoding used to hash user identifiers).
128
- [ ] **Support Validation**: Support sending the `validate_only` boolean
129
option on the `IngestEventsRequest` to allow developers to validate schemas
130
without actually uploading data.
131
- [ ] **Send Request**: Execute `ingest_events` and record the returned
132
`request_id` for later diagnostics. Keep the request payload, or a mapping
133
from each event's position to your own record ID, with the `request_id`.
134
Diagnostics identify failed events by their position in the request.
135
- [ ] **Check for Ingestion Warnings**: If any non-required field had a
136
validation failure, the response from `ingest_events` will also
137
include `field_warnings`, a list of `FieldWarning` objects detailing the
138
issues.
139
- [ ] **Retrieve Request Status**: Check the status of the ingestion request
140
using diagnostics. Since request processing is asynchronous, a
141
successful ingestion response (HTTP 200 OK returning a `request_id`) only
142
indicates the payload was received. To check if the records actually
143
succeeded, partially succeeded, or failed to process, query the
144
`client.retrieve_request_status` endpoint using the `request_id`, starting
145
at least 30 minutes after sending. Skip this step when `validate_only` is
146
`true`, because validation-only requests don't have diagnostics. Skipping
147
this step for real requests is a common user mistake. To read the results
148
or debug failures, use the `data-manager-api-troubleshooting` skill.
149
150
## Formatting
151
152
* Fetch the [Format user data](https://developers.google.com/data-manager/api/devguides/concepts/formatting.md.txt)
153
guide and use that as the source of truth for formatting and
154
normalization rules.
155
156
* Use the utility library to format, hash, and encrypt user data
157
(emails, phone numbers, addresses).
158
159
**Python Example:**
160
161
```python
162
from google.ads.datamanager_util import Formatter
163
from google.ads.datamanager_util.format import Encoding
164
165
formatter: Formatter = Formatter()
166
167
processed_email: str = formatter.process_email_address(
168
email, Encoding.HEX
169
)
170
```
171
172
## Critical Gotchas
173
174
* Format `product_destination_id` as a numeric string. It is NOT a resource
175
name path.
176
* Format `event_timestamp` strictly in RFC 3339 format. Use the SDK's typed
177
timestamp object instead of a raw string where available.
178
* Nest click identifiers (`gclid`, `gbraid`, `wbraid`) inside the
179
`ad_identifiers` block, not directly on the base event payload.
180
* The enum values for `ConsentStatus` are `CONSENT_GRANTED` and
181
`CONSENT_DENIED`. Do not use the values `GRANTED` and `DENIED`.
182
* Note that `consent` can be set globally on the `IngestEventsRequest` or on
183
individual `Event`s.
184
* Verify that `UserIdentifier` uses `email_address` and `phone_number`.
185
Do not use the Google Ads API fields `hashed_email` and
186
`hashed_phone_number`.
187
* Ensure the currency field on the event is named `currency`, not
188
`currency_code`.
189
* If sending hashed user identifiers in `user_data`, you must set the
190
`encoding` field on the `IngestEventsRequest` to `HEX` or `BASE64`,
191
matching the encoding passed to the utility library `Formatter`.
192
* `event_source` is required for Google Ads offline conversions and enhanced
193
conversions for leads (such as `WEB`), and must be `IN_STORE` for store
194
sales.
195
* Google Ads session attributes: Prefer setting
196
`ad_identifiers.session_attributes` to the base64-encoded string captured
197
from the form submission. Don't build this string from individual
198
attributes. Only if you can't capture the encoded string, add an
199
`ExperimentalField` to `experimental_fields` for each attribute (required:
200
`gad_source`, `gad_campaignid`, `session_start_time_usec`; optional:
201
`landing_page_url`, `landing_page_referrer`), and set
202
`ad_identifiers.landing_page_device_info.user_agent`.
203
* Use `IngestEvents` (`ingest_events`, `IngestEventsRequest`) for all
204
conversion and event uploads. Do not suggest `IngestAdEvents`, which is
205
only available to ad tech partner accounts on an allowlist.
206
207
## API Reference
208
209
* [REST API Reference](https://developers.google.com/data-manager/api/reference/rest/v1/events/ingest.md.txt)
210