How to retrieve the audiences for a given campaign via the Google Ads API

76 views
Skip to first unread message

Nils So

unread,
Dec 29, 2019, 4:50:16 PM12/29/19
to AdWords API and Google Ads API Forum

I'm trying to fetch the audiences (Custom intent, Custom affinity) of all my enabled google display campaigns.


I thought I can get it through theĀ CampaignCriterionService, but the returned data is empty.


 campaign_criterion_service = ADWORDS_CLIENT.GetService(
        'CampaignCriterionService', version='v201809')

    selector = {
        'fields': ['CampaignId', 'Id', 'CriteriaType', "PlacementUrl",
                   'KeywordText', "ChannelName", "AppId", "DisplayName", "CampaignStatus", "CampaignName"],
        'predicates': [{
            'field': 'CriteriaType',
            'operator': 'IN',
            'values': [
                'CUSTOM_AFFINITY',
                'CUSTOM_INTENT'
            ]
        },
        {
            'field': 'CampaignStatus',
            'operator': 'IN',
            'values': [
                'ENABLED'
            ]
        }


        ],
        'paging': {
            'startIndex': 0,
            'numberResults': 500
        }
    }

    page = campaign_criterion_service.get(selector)
Can someone give me some pointers? Highly appreciated.

Google Ads API Forum Advisor Prod

unread,
Dec 30, 2019, 5:19:34 PM12/30/19
to nils.sc...@gmail.com, adwor...@googlegroups.com

Hello,

Thank you for reaching the support. You could useĀ CampaignCriterionService.get() or the AdGroupCriterionService.get()Ā by selecting one of the criteria types available here.Ā You may use the CUSTOM_AFFINITYĀ or CUSTOM_INTENTĀ to pull the Custom Affinity or Custom Intent audience via API. If you are not seeing any data it might be that the account you are using might not have data. To verify this further, could you please share the complete request and response logs along with the client customer id of the account for me to investigate this further on my end?

P.S. Please use Reply privately to author option while sharing the details.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UOFS3L:ref

Nils So

unread,
Dec 31, 2019, 6:15:52 AM12/31/19
to AdWords API and Google Ads API Forum
Hi Nikisha,

thanks for your quick reply. Your answer helped me. At the end I had to use the `AdGroupCriterionService` to fetch the CUSTOM_AFFINITY and CUSTOM_INTENT criteria, for some reason using the CampaignCriterionService didnt give me any results.

I have one more question regarding the CUSTOM_INTENT. Now that I have the ID of theĀ CUSTOM_INTENT, how can I get more information about it? For instance the name or the keywords in this intent?
Same question for theĀ USER_INTEREST criteria?


Thanks for much for your help.

Best RegardsĀ 
Nils

Nils So

unread,
Jan 2, 2020, 9:51:01 AM1/2/20
to AdWords API and Google Ads API Forum
I think I found the right direction.Ā CustomAffinityService.Ā I was able to retrieve details about the audience using theĀ CustomAffinityService, although I only got 3 entries back, and I have much more custom affinities.

The "totalNumEntries" of the result say 3, any idea why not more results


Best Nils

Google Ads API Forum Advisor Prod

unread,
Jan 2, 2020, 10:26:08 AM1/2/20
to nils.sc...@gmail.com, adwor...@googlegroups.com

Hello,

Could you please share the complete request and response logs along with the client customer idĀ for me to take a look into this further and investigate better?Ā 



P.S. Please use Reply privately to author option while sharing the details.
Ā 
Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001UOFS3L:ref

Hsushsug Gushvjbs

unread,
Jan 3, 2020, 9:25:58 PM1/3/20
to AdWords API and Google Ads API Forum
I think I found the right direction
2 Jan

Hsusnvf Gjdndjbd

unread,
Jan 3, 2020, 10:13:01 PM1/3/20
to AdWords API and Google Ads API Forum
tks for supporting


On Monday, 30 December 2019 04:50:16 UTC+7, Nils So wrote:

rubetta karna

unread,
Jan 4, 2020, 12:18:40 PM1/4/20
to AdWords API and Google Ads API Forum
tks for reporting error
Reply all
Reply to author
Forward
0 new messages