您可以完成此快速入门,熟悉如何发送事件数据。
在以下任一场景中使用 Data Manager API:
将 Google Ads 代码转化或 Google Analytics 关键事件作为代码转化的额外数据源发送,以最大限度地提高广告互动信号,并增强数据和整体效果。
此功能仅适用于许可名单上的账号。如果您有兴趣添加 Google Ads 账号或 Google Analytics 媒体资源,请填写表单。
选择您要查看的指南版本:
在本快速入门中,您将完成以下步骤:
- 准备一个
Destination来接收事件数据。 - 准备要发送的事件数据。
- 为事件构建
IngestionService请求。 - 使用 Google APIs Explorer 发送请求。
- 了解成功和失败响应。
准备目的地
在发送数据之前,您需要为数据准备至少一个 Destination。以下是可供您使用的 Destination 示例:
{
"operatingAccount": {
"accountType": "OPERATING_ACCOUNT_TYPE",
"accountId": "OPERATING_ACCOUNT_ID"
},
"loginAccount": {
"accountType": "LOGIN_ACCOUNT_TYPE",
"accountId": "LOGIN_ACCOUNT_ID"
},
"productDestinationId": "PRODUCT_DESTINATION_ID"
}
以下是 Destination 的字段:
operatingAccount接收活动的账号。
对于作为附加数据源发送的事件,操作账号可以是 Google Ads 账号,也可以是 Google Analytics 媒体资源。将
accountType设置为GOOGLE_ADS或GOOGLE_ANALYTICS_PROPERTY,并将accountId设置为 Google Ads 客户 ID 或 Google Analytics 媒体资源 ID。如果accountType为GOOGLE_ANALYTICS_PROPERTY,则请求的凭据必须是针对具有相应媒体资源的编辑者或管理员角色的 Google Analytics 用户的凭据。对于线下转化和增强型潜在客户转化,操作账号必须是 Google Ads 账号,因此请将
accountType设置为GOOGLE_ADS,并将accountId设置为 Google Ads 客户 ID。loginAccount凭据的用户有权访问的账号。
如果您的 OAuth 凭据适用于有权访问 Google Ads 经理账号(其中一个子账号为
operatingAccount)的用户,则需要loginAccount。将loginAccount的accountId设置为经理账号的 ID,并将loginAccount的accountType设置为GOOGLE_ADS。如果您的 OAuth 凭据适用于可直接访问
operatingAccount的用户,则无需设置loginAccount,该参数会默认设置为operatingAccount。 不过,我们建议将loginAccount设置为与operatingAccount相同的accountId和accountType。这样有助于避免用户可访问的账号集发生变化时出现问题。productDestinationIdoperatingAccount中接收事件的实体的 ID。对于作为附加数据源发送的事件,
productDestinationId必须是type设置为WEBPAGE的 Google Ads 转化 ID,或者是 Google Analytics 网站数据流的衡量 ID。您无法将事件作为附加数据源发送到 Google Analytics iOS 应用或 Android 应用数据流。对于线下转化或增强型潜在客户转化,
productDestinationId必须是type设置为UPLOAD_CLICKS的 Google Ads 转化操作的 ID。
本指南中的示例展示了如何构建将所有事件发送到同一目的地的请求。如果您想在同一请求中为多个目的地发送事件,请参阅为多个目的地发送事件。
准备活动数据
请考虑以下活动数据。每个表都对应一个转化事件。每个转化事件都包含事件的时间戳、转化操作和转化价值。
每个事件可能包含广告标识符(例如 gclid)或用户标识符(例如电子邮件地址、电话号码和地址信息)。事件还可以包含:
- 在发生事件时评估的用户相关信息,例如客户价值,或者客户是新客户、回访客户还是重新吸引的客户。
- 购物车数据。
- 目的地的其他事件参数或用户属性,例如 Google Analytics 的
client_id或user_id。
以下是活动数据:
事件 1
| 活动 1 | |
|---|---|
conversion_time |
2025-06-10 15:07:01-05:00 |
conversion_action_id |
123456789 |
transaction_id |
ABC798654321 |
conversion_value |
30.03 |
currency |
USD |
gclid |
GCLID_1 |
emails |
|
given_name |
John |
family_name |
Smith-Jones |
region_code |
us |
postal_code |
94045 |
customer_type |
NEW |
customer_value_bucket |
HIGH |
client_id |
1234567890.1761581763 |
user_id |
user_ABC12345 |
ad_unit_name |
Banner_01 |
event_name |
purchase |
| 购物车中的商品 | |
item_id |
SKU_12345 |
item_name |
Stan and Friends Tee |
item_affiliation |
Google Merchandise Store |
item_coupon |
SUMMER_FUN |
item_discount |
2.22 |
item_index |
0 |
item_brand |
Google |
item_category |
Apparel |
item_category2 |
Adult |
item_category3 |
Shirts |
item_category4 |
Crew |
item_category5 |
Short sleeve |
item_list_id |
related_products |
item_list_name |
Related Products |
item_price |
10.01 |
item_quantity |
3 |
事件 2
| 活动 2 | |
|---|---|
conversion_time |
June 10, 2025 11:42:33PM America/New_York |
conversion_action_id |
123456789 |
transaction_id |
DEF999911111 |
conversion_value |
42.02 |
currency |
eur |
gclid |
GCLID_2 |
emails |
|
given_name |
zoë |
family_name |
pérez |
region_code |
PT |
postal_code |
1229-076 |
customer_type |
RETURNING |
client_id |
9876543210.1761582117 |
user_id |
user_DEF9876 |
ad_unit_name |
Banner_02 |
event_name |
purchase |
| 购物车中的商品 | |
item_id |
SKU_12346 |
item_name |
Google Grey Women's Tee |
item_affiliation |
Google Merchandise Store |
item_coupon |
SUMMER_FUN |
item_discount |
3.33 |
item_index |
1 |
item_brand |
Google |
item_category |
Apparel |
item_category2 |
Adult |
item_category3 |
Shirts |
item_category4 |
Crew |
item_category5 |
Short sleeve |
item_list_id |
related_products |
item_list_name |
Related Products |
item_price |
21.01 |
item_quantity |
2 |
设置数据格式
根据格式设置指南中的规定设置字段格式。以下是格式化后的活动数据:
事件 1
| 活动 1 | |
|---|---|
conversion_time |
2025-06-10T15:07:01-05:00 |
conversion_action_id |
123456789 |
transaction_id |
ABC798654321 |
conversion_value |
30.03 |
currency |
USD |
gclid |
GCLID_1 |
emails |
|
given_name |
john |
family_name |
smith-jones |
region_code |
US |
postal_code |
94045 |
customer_type |
NEW |
customer_value_bucket |
HIGH |
client_id |
1234567890.1761581763 |
user_id |
user_ABC12345 |
ad_unit_name |
Banner_01 |
event_name |
purchase |
| 购物车中的商品 | |
item_id |
SKU_12345 |
item_name |
Stan and Friends Tee |
item_affiliation |
Google Merchandise Store |
item_coupon |
SUMMER_FUN |
item_discount |
2.22 |
item_index |
0 |
item_brand |
Google |
item_category |
Apparel |
item_category2 |
Adult |
item_category3 |
Shirts |
item_category4 |
Crew |
item_category5 |
Short sleeve |
item_list_id |
related_products |
item_list_name |
Related Products |
item_price |
10.01 |
item_quantity |
3 |
事件 2
| 活动 2 | |
|---|---|
conversion_time |
2025-06-10T23:42:33-05:00 |
conversion_action_id |
123456789 |
transaction_id |
DEF999911111 |
conversion_value |
42.02 |
currency |
EUR |
gclid |
GCLID_2 |
emails |
|
given_name |
zoë |
family_name |
pérez |
region_code |
PT |
postal_code |
1229-076 |
customer_type |
RETURNING |
client_id |
9876543210.1761582117 |
user_id |
user_DEF9876 |
ad_unit_name |
Banner_02 |
event_name |
purchase |
| 购物车中的商品 | |
item_id |
SKU_12346 |
item_name |
Google Grey Women's Tee |
item_affiliation |
Google Merchandise Store |
item_coupon |
SUMMER_FUN |
item_discount |
3.33 |
item_index |
1 |
item_brand |
Google |
item_category |
Apparel |
item_category2 |
Adult |
item_category3 |
Shirts |
item_category4 |
Crew |
item_category5 |
Short sleeve |
item_list_id |
related_products |
item_list_name |
Related Products |
item_price |
21.01 |
item_quantity |
2 |
对数据进行哈希处理和编码
此外,格式化后的电子邮件地址、名字和姓氏必须使用 SHA-256 算法进行哈希处理,并使用十六进制或 Base64 编码进行编码。以下是使用十六进制编码进行格式化、哈希处理和编码后的事件数据:
事件 1
| 活动 1 | |
|---|---|
conversion_time |
2025-06-10T15:07:01-05:00 |
conversion_action_id |
123456789 |
transaction_id |
ABC798654321 |
conversion_value |
30.03 |
currency |
USD |
gclid |
GCLID_1 |
emails |
|
given_name |
96D9632F363564CC3032521409CF22A852F2032EEC099ED5967C0D000CEC607A |
family_name |
DB98D2607EFFFA28AFF66975868BF54C075ECA7157E35064DCE08E20B85B1081 |
region_code |
US |
postal_code |
94045 |
customer_type |
NEW |
customer_value_bucket |
HIGH |
client_id |
1234567890.1761581763 |
user_id |
user_ABC12345 |
ad_unit_name |
Banner_01 |
event_name |
purchase |
| 购物车中的商品 | |
item_id |
SKU_12345 |
item_name |
Stan and Friends Tee |
item_affiliation |
Google Merchandise Store |
item_coupon |
SUMMER_FUN |
item_discount |
2.22 |
item_index |
0 |
item_brand |
Google |
item_category |
Apparel |
item_category2 |
Adult |
item_category3 |
Shirts |
item_category4 |
Crew |
item_category5 |
Short sleeve |
item_list_id |
related_products |
item_list_name |
Related Products |
item_price |
10.01 |
item_quantity |
3 |
事件 2
| 活动 2 | |
|---|---|
conversion_time |
2025-06-10T23:42:33-05:00 |
conversion_action_id |
123456789 |
transaction_id |
DEF999911111 |
conversion_value |
42.02 |
currency |
EUR |
gclid |
GCLID_2 |
emails |
|
given_name |
2752B88686847FA5C86F47B94CE652B7B3F22A91C37617D451A4DB9AFA431450 |
family_name |
6654977D57DDDD3C0329CA741B109EF6CD6430BEDD00008AAD213DF25683D77F |
region_code |
PT |
postal_code |
1229-076 |
customer_type |
RETURNING |
client_id |
9876543210.1761582117 |
user_id |
user_DEF9876 |
ad_unit_name |
Banner_02 |
event_name |
purchase |
| 购物车中的商品 | |
item_id |
SKU_12346 |
item_name |
Google Grey Women's Tee |
item_affiliation |
Google Merchandise Store |
item_coupon |
SUMMER_FUN |
item_discount |
3.33 |
item_index |
1 |
item_brand |
Google |
item_category |
Apparel |
item_category2 |
Adult |
item_category3 |
Shirts |
item_category4 |
Crew |
item_category5 |
Short sleeve |
item_list_id |
related_products |
item_list_name |
Related Products |
item_price |
21.01 |
item_quantity |
2 |
将数据转换为 Event 对象
将每个事件的格式化和哈希处理后的数据转换为 Event。按如下所示填充以下字段:
将
eventTimestamp设置为事件发生的时间。Google Analytics 的事件必须具有过去 72 小时内的
eventTimestamp。为您的使用场景设置必填字段。
使用场景 标识符 transactionIdeventSource线下转化或增强型潜在客户转化 必需。设置以下至少一项: adIdentifiers,且至少设置了gclid、gbraid、wbraid或sessionAttributes中的一个userData
可选 必需。设置为 EventSource的某个枚举值。作为附加数据源发送到 Google Ads 目标平台的事件 必需。设置以下至少一项: adIdentifiers,且至少设置了gclid、gbraid或wbraid中的一个userData
必需 可选。如果设置,则必须为 WEB。作为附加数据源发送到 Google Analytics 目标平台的事件 必需。设置以下至少一项: clientIdadIdentifiers(已设置gclid)userData
必需 可选。如果设置,则必须为 WEB。填写您知道相应活动值的任何其他字段。如需查看可用字段的完整列表,请参阅
Event参考文档。
添加 Google Analytics 信息
如果作为附加数据源发送的事件的目标位置包含 Google Analytics 媒体资源,请按指示填充以下字段:
eventName必需。Google Analytics 事件的名称。
transactionId必需。事件的唯一标识符。
- 至少一个标识符
必须设置以下字段中的至少一个:
clientId:Web 客户端的用户实例的唯一标识符。请参阅将事件发送到 Measurement Protocol。
destinationReferences如果请求级
destinations列表包含多个 Google AnalyticsDestination,则此属性为必需属性。向destinationReferences添加一个条目,以指定哪个 Google Analytics 目标位置应接收相应事件。如需详细了解目的地引用,请参阅将事件发送到多个目的地。如果未设置
destinationReferences或该参数包含多个指向 Google Analytics 目的地的条目,Data Manager API 会拒绝该事件,并返回MULTIPLE_DESTINATIONS_FOR_GOOGLE_ANALYTICS_EVENT错误。userId可选。用户的 User-ID。
additionalEventParameters可选,但建议填写。使用其他
Event字段中未捕获的任何 Google Analytics 事件参数填充此列表。这些参数可以包括purchase事件中的其他推荐参数,也可以包括您想捕获的其他参数。针对EventParameter的parameterName使用 Google Analytics 参数名称。例如,如果您有与交易相关的税费,请向
additionalEventParameters添加一个条目,并将parameterName设置为tax,并将value设置为税费。我们不建议为
transactionId、currency或valueGoogle Analytics 事件参数添加条目。请改为填充Event的transactionId、currency和conversionValue,这些属性优先于additionalEventParameters中的任何条目。
为购买事件添加购物车数据
使用所购商品的相关信息填充 Event 的 cartData 字段。对于购买的每件商品,请向 CartData 的 items 列表中添加一个 Item 对象,并按指示填充以下字段:
itemId- 必需。商品的唯一标识符。
unitPrice必需。不含税、运费和事件级(交易级)折扣的单价。
如果商品有商品级折扣,请使用折扣后的单价。 例如,如果某商品的单价为
27.67,单位折扣为6.66,则将unitPrice设置为21.01。quantity必需。购买的相应商品的数量。
additionalItemParameters使用未在其他
Item字段中捕获的任何商品级范围参数填充此列表。针对ItemParameter的parameterName使用 Google Analytics 商品参数名称。例如,如果您有商品的品牌和类别,请向商品的
additionalItemParameters添加一个条目,其中parameterName设置为item_brand,value设置为品牌名称;再添加一个条目,其中parameterName设置为item_category,value设置为商品的类别。我们不建议为
quantity、price或item_idGoogle Analytics 商品参数添加条目。请改为填充Item的itemId、unitPrice和quantity,这些属性的优先级高于additionalItemParameters中的任何条目。
以下是第二个事件的格式化、哈希处理和编码数据的示例 Event,其中包含 Google Analytics 的其他数据:
{
"adIdentifiers": {
"gclid": "GCLID_2"
},
"conversionValue": 42.02,
"currency": "EUR",
"eventTimestamp": "2025-06-10T23:42:33-05:00",
"transactionId": "DEF999911111",
"eventSource": "WEB",
"userData": {
"userIdentifiers": [
{
"emailAddress": "3E693CF7E5B67880BFF33B2D2626DADB7BF1D4BC737192E47CF8BAA89ACF2250"
},
{
"emailAddress": "223EBDA6F6889B1494551BA902D9D381DAF2F642BAE055888E96343D53E9F9C4"
},
{
"address": {
"givenName": "2752B88686847FA5C86F47B94CE652B7B3F22A91C37617D451A4DB9AFA431450",
"familyName": "6654977D57DDDD3C0329CA741B109EF6CD6430BEDD00008AAD213DF25683D77F",
"regionCode": "PT",
"postalCode": "1229-076"
}
}
],
},
"userProperties": {
"customerType": "RETURNING"
},
"eventName": "purchase",
"clientId": "9876543210.1761582117",
"userId": "user_DEF9876",
"additionalEventParameters": [
{
"parameterName": "ad_unit_name",
"value": "Banner_02"
}
],
"cartData": {
"transactionDiscount": 6.66,
"items": [
{
"itemId": "SKU_12346",
"quantity": 2,
"unitPrice": 21.01,
"additionalItemParameters": [
{
"parameterName": "item_name",
"value": "Google Grey Women's Tee"
},
{
"parameterName": "affiliation",
"value": "Google Merchandise Store"
},
{
"parameterName": "coupon",
"value": "SUMMER_FUN"
},
{
"parameterName": "discount",
"value": "3.33"
},
{
"parameterName": "index",
"value": "1"
},
{
"parameterName": "item_brand",
"value": "Google"
},
{
"parameterName": "item_category",
"value": "Apparel"
},
{
"parameterName": "item_category2",
"value": "Adult"
},
{
"parameterName": "item_category3",
"value": "Shirts"
},
{
"parameterName": "item_category4",
"value": "Crew"
},
{
"parameterName": "item_category5",
"value": "Short sleeve"
},
{
"parameterName": "item_list_id",
"value": "related_products"
},
{
"parameterName": "item_list_name",
"value": "Related Products"
}
]
}
]
}
}
构建请求正文
将 Destination 和 Events 组合为请求正文:
{
"destinations": [
{
"operatingAccount": {
"accountType": "OPERATING_ACCOUNT_TYPE",
"accountId": "OPERATING_ACCOUNT_ID"
},
"loginAccount": {
"accountType": "LOGIN_ACCOUNT_TYPE",
"accountId": "LOGIN_ACCOUNT_ID"
},
"productDestinationId": "CONVERSION_ACTION_1_ID"
}
],
"encoding": "HEX",
"events": [
{
"adIdentifiers": {
"gclid": "GCLID_1"
},
"conversionValue": 30.03,
"currency": "USD",
"eventTimestamp": "2025-06-10T20:07:01Z",
"transactionId": "ABC798654321",
"eventSource": "WEB",
"userData": {
"userIdentifiers": [
{
"address": {
"givenName": "96D9632F363564CC3032521409CF22A852F2032EEC099ED5967C0D000CEC607A",
"familyName": "DB98D2607EFFFA28AFF66975868BF54C075ECA7157E35064DCE08E20B85B1081",
"regionCode": "US",
"postalCode": "94045"
}
}
]
},
"userProperties": {
"customerType": "NEW",
"customerValueBucket": "HIGH"
},
"eventName": "purchase",
"clientId": "1234567890.1761581763",
"userId": "user_ABC12345",
"additionalEventParameters": [
{
"parameterName": "ad_unit_name",
"value": "Banner_01"
}
],
"cartData": {
"transactionDiscount": 6.66,
"items": [
{
"itemId": "SKU_12345",
"quantity": 3,
"unitPrice": 10.01,
"additionalItemParameters": [
{
"parameterName": "item_name",
"value": "Stan and Friends Tee"
},
{
"parameterName": "affiliation",
"value": "Google Merchandise Store"
},
{
"parameterName": "coupon",
"value": "SUMMER_FUN"
},
{
"parameterName": "discount",
"value": "2.22"
},
{
"parameterName": "index",
"value": "0"
},
{
"parameterName": "item_brand",
"value": "Google"
},
{
"parameterName": "item_category",
"value": "Apparel"
},
{
"parameterName": "item_category2",
"value": "Adult"
},
{
"parameterName": "item_category3",
"value": "Shirts"
},
{
"parameterName": "item_category4",
"value": "Crew"
},
{
"parameterName": "item_category5",
"value": "Short sleeve"
},
{
"parameterName": "item_list_id",
"value": "related_products"
},
{
"parameterName": "item_list_name",
"value": "Related Products"
}
]
}
]
}
},
{
"adIdentifiers": {
"gclid": "GCLID_2"
},
"conversionValue": 42.02,
"currency": "EUR",
"eventTimestamp": "2025-06-11T04:42:33Z",
"transactionId": "DEF999911111",
"eventSource": "WEB",
"userData": {
"userIdentifiers": [
{
"emailAddress": "3E693CF7E5B67880BFF33B2D2626DADB7BF1D4BC737192E47CF8BAA89ACF2250"
},
{
"emailAddress": "223EBDA6F6889B1494551BA902D9D381DAF2F642BAE055888E96343D53E9F9C4"
},
{
"address": {
"givenName": "2752B88686847FA5C86F47B94CE652B7B3F22A91C37617D451A4DB9AFA431450",
"familyName": "6654977D57DDDD3C0329CA741B109EF6CD6430BEDD00008AAD213DF25683D77F",
"regionCode": "PT",
"postalCode": "1229-076"
}
}
]
},
"userProperties": {
"customerType": "RETURNING"
},
"eventName": "purchase",
"clientId": "9876543210.1761582117",
"userId": "user_DEF9876",
"additionalEventParameters": [
{
"parameterName": "ad_unit_name",
"value": "Banner_02"
}
],
"cartData": {
"transactionDiscount": 6.66,
"items": [
{
"itemId": "SKU_12346",
"quantity": 2,
"unitPrice": 21.01,
"additionalItemParameters": [
{
"parameterName": "item_name",
"value": "Google Grey Women's Tee"
},
{
"parameterName": "affiliation",
"value": "Google Merchandise Store"
},
{
"parameterName": "coupon",
"value": "SUMMER_FUN"
},
{
"parameterName": "discount",
"value": "3.33"
},
{
"parameterName": "index",
"value": "1"
},
{
"parameterName": "item_brand",
"value": "Google"
},
{
"parameterName": "item_category",
"value": "Apparel"
},
{
"parameterName": "item_category2",
"value": "Adult"
},
{
"parameterName": "item_category3",
"value": "Shirts"
},
{
"parameterName": "item_category4",
"value": "Crew"
},
{
"parameterName": "item_category5",
"value": "Short sleeve"
},
{
"parameterName": "item_list_id",
"value": "related_products"
},
{
"parameterName": "item_list_name",
"value": "Related Products"
}
]
}
]
}
}
],
"validateOnly": true
}
- 将正文中的占位符(例如
OPERATING_ACCOUNT_ID和PRODUCT_DESTINATION_ID)替换为您的账号和目标值。 - 将
validateOnly设置为true,以验证请求但不应用更改。准备好应用更改后,请将validateOnly设置为false。 - 请注意,此示例未使用加密。
发送请求
- 使用示例右上角的复制按钮复制请求正文。
- 点击工具栏中的 API 按钮。
- 将复制的请求正文粘贴到请求正文框中。
- 点击执行按钮,完成授权提示,然后查看响应。
成功响应
如果请求成功,则返回的响应会包含一个包含 requestId 的对象。
{
"requestId": "126365e1-16d0-4c81-9de9-f362711e250a"
}
记录返回的 requestId,以便在处理请求中的每个目的地时检索诊断信息。
失败响应
如果请求失败,系统会返回错误响应状态代码(例如 400 Bad
Request)以及包含错误详细信息的响应。
例如,包含纯文本字符串而非十六进制编码值的 emailAddress 会生成以下响应:
{
"error": {
"code": 400,
"message": "There was a problem with the request.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "INVALID_ARGUMENT",
"domain": "datamanager.googleapis.com"
},
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "events.events[0].user_data.user_identifiers",
"description": "Email is not hex encoded.",
"reason": "INVALID_HEX_ENCODING"
}
]
}
]
}
}
未经过哈希处理且仅经过十六进制编码的 emailAddress 会产生以下响应:
{
"error": {
"code": 400,
"message": "There was a problem with the request.",
"status": "INVALID_ARGUMENT",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "INVALID_ARGUMENT",
"domain": "datamanager.googleapis.com"
},
{
"@type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "events.events[0]",
"reason": "INVALID_SHA256_FORMAT"
}
]
}
]
}
}
为多个目标平台发送事件
如果您的数据包含针对不同目的地的事件,您可以使用目的地引用在同一请求中发送这些事件。
例如,如果您有一个转化操作 ID 为 123456789 的事件,以及另一个转化操作 ID 为 777111122 的事件,请通过设置每个 Destination 的 reference,在单个请求中发送这两个事件。reference 由用户定义。唯一的要求是每个 Destination 都具有唯一的 reference。以下是针对相应请求修改后的 destinations 列表:
"destinations": [
{
"operatingAccount": {
"accountType": "OPERATING_ACCOUNT_TYPE",
"accountId": "OPERATING_ACCOUNT_ID"
},
"loginAccount": {
"accountType": "LOGIN_ACCOUNT_TYPE",
"accountId": "LOGIN_ACCOUNT_ID"
},
"productDestinationId": "PRODUCT_DESTINATION_ID",
"reference": "destination_a"
},
{
"operatingAccount": {
"accountType": "OPERATING_ACCOUNT_2_TYPE",
"accountId": "OPERATING_ACCOUNT_2_ID"
},
"loginAccount": {
"accountType": "LOGIN_ACCOUNT_2_TYPE",
"accountId": "LOGIN_ACCOUNT_2_ID"
},
"productDestinationId": "777111122",
"reference": "destination_b"
}
]
设置每个 Event 的 destinationReferences,以将其发送到一个或多个特定目的地。例如,以下 Event 仅适用于第一个 Destination,因此其 destinationReferences 列表仅包含第一个 Destination 的 reference:
{
"adIdentifiers": {
"gclid": "GCLID_1"
},
"conversionValue": 1.99,
"currency": "USD",
"eventTimestamp": "2025-06-10T20:07:01Z",
"transactionId": "ABC798654321",
"eventSource": "WEB",
"destinationReferences": [
"destination_a"
]
}
destinationReferences 字段是一个列表,因此您可以为事件指定多个目的地。如果您未设置 Event 的 destinationReferences,Data Manager API 会将相应事件发送到请求中的所有目的地。
如果某个事件有多个目标账号,Data Manager API 会将相关字段发送到每个目标账号。例如,如果某个事件同时具有 Google Ads 目的地和 Google Analytics 目的地,则当该 API 将事件发送到 Google Analytics 目的地时,会包含 clientId 或 eventName 等 Google Analytics 字段;而当该 API 将事件发送到 Google Ads 目的地时,会包含 customVariables 等 Google Ads 字段。