Working on my Campaign's audiences, I noticed that they don't all have the same In-Market audiences associated to them.
I tried to remedy that by associating all my relevant In Market audiences to all my campaigns, using the Audience Builder found
here in the AdsApp documentation.
However I can't manage to make it work. Here is what I tried :
function main() {
//Select one of the account's campaign
var campaignSelector = AdWordsApp.campaigns().withCondition("CampaignName = 'ES - TXT - Call - B - [Iberdrola]'").get()
var campaign = campaignSelector.next()
/*
We are going to try to add the In Market audience "Home Decor Enthusiasts" to this campaign
id : 51668104375
audienceId : 92508
*/
//Trying with the Id. Works in PREVIEW, but gives the error "Item not found" when RUN.
var id = 51668104375
var audienceBuilder = campaign.targeting().newUserListBuilder().withAudienceId(id).withBidModifier(0).build()
//Same result with the audienceId.
var audienceId = 92508
var audienceBuilder = campaign.targeting().newUserListBuilder().withAudienceId(audienceId).withBidModifier(0).build()
//I also tried this, using newAudienceBuilder. But apparently this method doesn't apply in this context.
//var audienceBuilder = campaign.targeting().newAudienceBuilder().withAudienceId(audienceId).withBidModifier(0).build()
//This test gives success in PREVIEW mode, but succesn't in RUN mode.
if (audienceBuilder.isSuccessful()) {
var success = "success";
}
else{
var success = "succesn't";
}
Logger.log(success)
//Check if the audience has been created with the correct bid modifier
var afterChangeBidModifier = campaign.targeting().audiences().withIds([51668104375]).get().next().bidding().getBidModifier()
Logger.log("After change : " + afterChangeBidModifier)
}
I don't know what I am doing wrong. Is this method not supposed to work for In-Market audience ? And if not, wich one should I use ?