Interest ID and Affinity ID

179 views
Skip to first unread message

Petra Manos

unread,
Jun 1, 2021, 3:27:11 AM6/1/21
to Google Ads Scripts Forum
Hi,

Does anyone know where I can get a list of all the available interest and affinity IDs, with their name and their ID?

Best wishes,

Petra Manos

Google Ads Scripts Forum Advisor

unread,
Jun 1, 2021, 6:13:39 AM6/1/21
to adwords...@googlegroups.com
Hi Petra,

Harry here, from the Google Ads Scripts Team. Allow me to assist you on this.

You can refer to the AdWords API - Codes and Formats page. This page contains tables of criterion IDs and system codes and formats (for example: currencies, dates, locales) which also includes interest and affinity IDs with their category. Let me know if there's anything else I can assist you with.

Thanks,
Google Logo
Harry Cliford Rivera
Google Ads Scripts Team
 


ref:_00D1U1174p._5004Q2HzCaX:ref

Petra Manos

unread,
Jun 1, 2021, 8:11:36 PM6/1/21
to Google Ads Scripts Forum
Can you help me please Harry, I get error "Item not found".
Script-details-Clinical-Myotherapy-Group-Google-Ads.png


The criteria I am adding are criteria from the list you shared above, eg in-market categories 80253, 80559 for example.

The code I use to add the criteria is:

nextCampaign.targeting().newUserListBuilder().withAudienceId(criteriaID).build();

I am passing in the criteriaID as an integer.

What am I doing wrong?

Google Ads Scripts Forum Advisor

unread,
Jun 2, 2021, 12:17:20 AM6/2/21
to adwords...@googlegroups.com
Hi,

Thanks for coming back. Kindly provide your CID and script name so that I can take a closer look at the issue you are encountering.

Google Ads Scripts Forum Advisor

unread,
Jun 2, 2021, 6:42:29 AM6/2/21
to adwords...@googlegroups.com
Hi Petra, 

Thanks for providing the details. Would you be able to also identify and provide me the Audience IDs that resulted into the error? Just so I can be sure that I replicate the same error on my end. Looking forward to your reply.

Petra Manos

unread,
Jun 2, 2021, 10:34:59 PM6/2/21
to Google Ads Scripts Forum
Hi Harry,

Please try these ones as examples:
  • 80149
  • 80204
  • 80288
  • 80425
  • 80538

Google Ads Scripts Forum Advisor

unread,
Jun 3, 2021, 4:43:57 AM6/3/21
to adwords...@googlegroups.com
Hi Petra,

Thanks for your patience here. I have checked on your script thoroughly and noticed that you use the newUserListBuilder to apply Affinity audiences. However, this method/builder is only for Search Campaigns which will point you to the SearchCampaignAudienceBuilder for CampaignTargeting. For Display Campaigns, you would have to use the AudienceBuilder instead. Please see CampaignDisplay for your reference.

Kindly take note also that Affinity and Interest Audiences are only applicable for Display Campaigns currently so applying them to Shopping and Search Campaigns would not be possible; hence, why you are running into the errors. For Shopping Campaign Audiences, please use the ShoppingCampaignAudienceBuilder instead. To sum this up, you would have to use different audience builders for each campaign type.


Let me know if there's anything else I can assist you with.

Petra Manos

unread,
Jun 3, 2021, 8:06:04 PM6/3/21
to Google Ads Scripts Forum
The google scripts support say that you have to instantiate the SearchCampaignAudienceBuilder with the newUserListBuilder. Here is where I see it:

AdsApp-​SearchCampaignAudienceBuilder-Google-Ads-scripts.png

Picking the specific type of list builder isn't available to me on the CampaignTargeting object. Does it have to be cast? If so, can you please give example syntax as I have not cast an Object type in javascript and it is not done in the example above.

Also, are you saying that using the SearchCampaignAudienceBuilder and ShoppingCampaignAudienceBuilder I will still be unable to add in-market and affinity audiences?

Best wishes,

Petra Manos

Google Ads Scripts Forum Advisor

unread,
Jun 4, 2021, 2:57:15 AM6/4/21
to adwords...@googlegroups.com
Hi Petra,

To explain further, you would need to first determine the campaign type and use the appropriate Audience builder for the campaign. You can only use the targeting().newUserListBuilder for Search Campaigns. Use the display().newAudienceBuilder() for Display Campaigns. For Shopping Campaigns, use targeting().newUserListBuilder() method instead. Please see code below for your reference:
var displayCampaign = AdsApp.campaigns().get().next(); // filter display campaigns
var displayAudienceBuilder = displayCampaign.display().newAudienceBuilder();

var searchCampaign = AdsApp.campaigns().get().next(); // filter search campaigns
var searchAudienceBuilder = searchCampaign.targeting().newUserListBuilder();

var shoppingCampaign = AdsApp.shoppingCampaigns().get().next();
var shoppingAudienceBuilder = shoppingCampaign.targeting().newUserListBuilder();
Furthermore, Affinity and Interest Audiences can only be applied to Display Campaigns.

Hope this helps. Let me know your thoughts.

Petra Manos

unread,
Jun 4, 2021, 3:00:21 AM6/4/21
to Google Ads Scripts Forum
OK, yes this is exactly the syntax that I used. So the issue has nothing to do with the syntax I used, but is just because the API doesn't handle Affinity and In-market audiences for Search and Shopping.

When will this be implemented? Is there a feature request list?

Best wishes,

Petra Manos

Google Ads Scripts Forum Advisor

unread,
Jun 4, 2021, 5:29:43 AM6/4/21
to adwords...@googlegroups.com
Hi Petra,

As far as I can tell, it's not an API limitation, but rather is a Google Ads limitation as whole with regard to supported Audiences per campaign type. You can reach out to the Google Ads Product Team instead in this regard. You contact their team through this link.

Petra Manos

unread,
Jun 6, 2021, 8:33:18 PM6/6/21
to Google Ads Scripts Forum
You can add in-market and affinity audiences to Shopping and Search campaigns in Google Ads. I do it all the time.

Google Ads Scripts Forum Advisor

unread,
Jun 6, 2021, 11:13:51 PM6/6/21
to adwords...@googlegroups.com
Hi Petra,

Thanks for providing insights. I would then suggest that you use appropriate Audience Builders for each Campaign types. Let me know if you encounter issues after trying.

Petra Manos

unread,
Jun 7, 2021, 4:31:16 AM6/7/21
to Google Ads Scripts Forum
How do you cast to the respective types, and do you have a working example?

I think this is an API issue.

Google Ads Scripts Forum Advisor

unread,
Jun 7, 2021, 6:42:34 AM6/7/21
to adwords...@googlegroups.com
Hi Petra,

Thanks for coming back. You wont need to cast to the respective types. You would just need to first determine the campaign type and use the appropriate Audience builder for the campaign. You can only use the targeting().newUserListBuilder for Search Campaigns. Use the display().newAudienceBuilder() for Display Campaigns. For Shopping Campaigns, use targeting().newUserListBuilder() method instead. Please see code below for your reference:
var displayCampaign = AdsApp.campaigns().get().next(); // filter display campaigns
var displayAudienceBuilder = displayCampaign.display().newAudienceBuilder();

var searchCampaign = AdsApp.campaigns().get().next(); // filter search campaigns
var searchAudienceBuilder = searchCampaign.targeting().newUserListBuilder();

var shoppingCampaign = AdsApp.shoppingCampaigns().get().next();
var shoppingAudienceBuilder = shoppingCampaign.targeting().newUserListBuilder();

Petra Manos

unread,
Jun 7, 2021, 7:38:01 AM6/7/21
to Google Ads Scripts Forum
Hi Harry, if you recall the code example you looked at, the syntax you suggest was exactly the syntax that I had that you reviewed and that gave error "item not found".

The specific example I showed you only had search campaigns, not Display campaigns, and my syntax was exactly as you describe above.

Do you have an example of a search campaign specifically where the syntax you suggest is used, and it definitely works with Affinity and/or in-market audiences?

Google Ads Scripts Forum Advisor

unread,
Jun 8, 2021, 5:43:09 AM6/8/21
to adwords...@googlegroups.com
Hi Petra,

Can you kindly point me again to the line of code in your script where you apply the audiences that results into the issue at hand? I was going to double check, but it seems that you may have updated your script? I would appreciate it if you can provide so that I can align my testing with the same exact code that you have written.


Looking forward to your reply.

Reply all
Reply to author
Forward
0 new messages