【发布时间】:2019-08-07 03:22:39
【问题描述】:
我正在尝试将受众列表(我已经使用 python api 在 Google 广告上创建)附加到同一 Google 广告帐户上的现有广告系列。我有广告系列的 ID 和受众列表的 ID,但我在文档中没有找到任何关于如何将受众列表附加到广告系列的明确示例。
谁能提供示例,说明要发送到谷歌广告的 json 对象如何构造以请求将受众列表添加到广告系列?
我尝试按照documentation 中的参考指南编写需要发送的请求 json 格式对象,以将受众列表添加到某个活动。
还搜索了类似的问题,在Java中找到了这个solution,但是我没有成功在python中想出类似的问题。
from googleads import adwords
import yaml
data = {} # should contain credentials for authentication
auth_data = yaml.dump(data)
client = adwords.AdWordsClient.LoadFromString(auth_data)
campaign_criterion_list_service = client.GetService(
'CampaignCriterionService', version='v201809')
operations = [
{
'operand': {
'campaignId': 1982314222, # some campaign in my account
'criterion': {
'type': 'USER_LIST',
'id': 823895895,# an existing audience list on my google ads account
},
'campaignCriterionStatus': 'ACTIVE'
},
'operator': 'ADD',
}
]
campaign_criterion_list_service.mutate(operations)
但它无法提供错误
GoogleAdsServerFault: [CampaignCriterionError.CONCRETE_TYPE_REQUIRED @ operations[0].operand.criterion]
我希望将受众列表添加到活动中并返回成功代码。
【问题讨论】:
标签: python google-ads-api