Add affinity/in market audience to campaign from Adwords API

25 views
Skip to first unread message

Trine....@groupm.com

unread,
Jan 3, 2019, 4:12:27 PM1/3/19
to AdWords API and Google Ads API Forum
Hi Support, 

I want to add audiences to some campaigns in Adwords Api. 

This code currently works, however it does not recognize the Audience ID's which I gave, and it does not seem like it corresponds to the ids from the report. E.g. "uservertical::933005" nor 296911073664 works for the audience: "Frequently Eats Dinner Out". Which ID's are required for this function to work?

function interests() {
   var interests = []
   var campaignIterator = AdsApp.campaigns().withIds([1668598316]).get()
   while (campaignIterator.hasNext()){
     var campaign = campaignIterator.next()
     var adgroupIterator = campaign.adGroups().get()
     while (adgroupIterator.hasNext()){
       var adgroup = adgroupIterator.next()
        var audienceBuilder = adgroup.targeting().newUserListBuilder();
  var audienceOperation = audienceBuilder
    .withAudienceId(1000)              // required
    .withBidModifier(1.1)             // optional
  .build();                       // add the audience
var audience = audienceOperation.getResult()}}}

Luis Xander Talag (AdWords API Team)

unread,
Jan 4, 2019, 12:54:47 AM1/4/19
to AdWords API and Google Ads API Forum
Hi Trine,

It seems that you are using Google Ads Scripts and not AdWords API. Kindly post your concern in the Google Ads Scripts Forum instead as this is out of scope for our team.

Thanks,
Luis
AdWords API Team
Reply all
Reply to author
Forward
0 new messages