使用Adwords API向广告组添加自定义受众群体

问题描述 投票:1回答:1

我正在使用Adwords的python librairy,我需要选择要链接到给定广告组的受众群体。我需要选择再营销和类似,自定义意图或亲和力的受众群体。

如何在创建广告组时设置受众群体?

python google-adwords
1个回答
0
投票

所以经过一些测试后,如何做到这一点:

  1. 创建广告组并获取其ID
  2. 使用AdGroupCriterionService添加观众

这是我想要使用的3种类型的观众的代码(self.client正在启动adwords.AdWordsClient.LoadFromStorage):

        ad_group_criterion_service = self.client.GetService('AdGroupCriterionService', version='v201809')
        audience_custom_affinity = {
            'xsi_type': 'BiddableAdGroupCriterion',
            'adGroupId': 'my_ad_group_id',
            'criterion': {
                'xsi_type': 'CriterionCustomAffinity',
                'type': 'CUSTOM_AFFINITY',
                'customAffinityId': 'my_audience_id'
            }
        }
        audience_custom_intent = {
            'xsi_type': 'BiddableAdGroupCriterion',
            'adGroupId': 'my_ad_group_id',
            'criterion': {
                'xsi_type': 'CriterionCustomIntent',
                'type': 'CUSTOM_INTENT',
                'customIntentId': 'my_audience_id'
            }
        }
        audience_remarketing = {
            'xsi_type': 'BiddableAdGroupCriterion',
            'adGroupId': 'my_ad_group_id',
            'criterion': {
                'xsi_type': 'CriterionUserList',
                'type': 'USER_LIST',
                'userListId': 'my_audience_id'
            }
        }
        operations = [
            {'operator': 'ADD',
                'operand': audience_custom_affinity},
            { 'operator': 'ADD',
                'operand': audience_custom_intent},
            {'operator': 'ADD',
            'operand': audience_remarketing}
        ]
        ad_group_criterion_service.mutate(operations)
© www.soinside.com 2019 - 2024. All rights reserved.