Adding an In-Market Audience to a campaign with audienceBuilder

63 views
Skip to first unread message

Mathis LAVAUD

unread,
Aug 19, 2020, 4:04:43 AM8/19/20
to Google Ads Scripts Forum
Hello, 

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 ?

Regards, 
Mathis

Google Ads Scripts Forum Advisor

unread,
Aug 19, 2020, 4:43:02 AM8/19/20
to adwords...@googlegroups.com
Hi Mathis,

Thanks for posting your concern.

If you want to create and apply in-market audiences, you can refer to this document instead. Please note that this method can only be used to apply in-market audiences to display campaigns and search campaign with enabled 'Include Google Display Network' option.

Let me know if you have further questions.

Regards,
Ejay
Google Ads Scripts Team

ref:_00D1U1174p._5004Q23LOZ1:ref

Mathis LAVAUD

unread,
Aug 20, 2020, 3:16:05 AM8/20/20
to Google Ads Scripts Forum
Hi Ejay, 

Thank you for your answer.

Sadly my campaigns are search campaigns only, so I cannot use this method...

I do not understand why the method I tried does not work, as I followed exactly the AdsApp documentation regarding campaign level audienceBuilder : documentation audienceBuilders.

Do you know why this could be ?

Regards, 

Mathis

Google Ads Scripts Forum Advisor

unread,
Aug 20, 2020, 5:03:31 AM8/20/20
to adwords...@googlegroups.com
Hi Mathis,

The document that you provided can only be used to associate user list or remarketing list to search campaign.

If you want to add in-market audience to search campaign/ad group, then you can use the document I provided previously. However, please note that it will only work for search campaign with enabled 'Include Google Display Network' option.

Hope this will help.

Mathis LAVAUD

unread,
Aug 21, 2020, 4:00:32 AM8/21/20
to Google Ads Scripts Forum
Hi Ejay,

To make a test, I enabled  'Include Google Display Network'  for one of my campaigns, and I try using the method you linked me like so :

  var audienceBuilder = campaign.display().newAudienceBuilder()
  var audience = audienceBuilder
    .withAudienceType('USER_INTEREST')
    .withAudienceId(90211)
    .withCpc(0.01)
    .build()

Where "campaign" is the campaign I mentionned, and the "audience Id" is one that is not associated with this campaign yet. 

However I get this error when trying to Preview :
Method build() threw the following exception: Keywords, placements, topics, and audiences can only be created at the ad group level. (file xxx, line 60)  

Are you sure that this method is suppose to work for campaign level audiences ?

Regards,

Mathis

Google Ads Scripts Forum Advisor

unread,
Aug 21, 2020, 2:07:30 PM8/21/20
to adwords...@googlegroups.com
Hi Mathis,

My name is Matt and I work on the scripts team.

Would you mind providing your CID and script name so we can investigate the original 'Item not found' error that you mentioned in your first post?

Thanks,
Matt

Mathis LAVAUD

unread,
Aug 25, 2020, 5:57:13 AM8/25/20
to Google Ads Scripts Forum
Hi Matt, 

Thank you for your attention.

The function "Reply to the author" does not work for me.

Is there a way I can give you my account ID in private ?

(In the past your team had told me to send it directly on the forum and deleted my answer as soon as they got it).

Regards,
Mathis

Google Ads Scripts Forum Advisor

unread,
Aug 25, 2020, 1:41:09 PM8/25/20
to adwords...@googlegroups.com
Hi Mathis,

Instead of providing that information here on the forum, please send us an email at googleadsscr...@google.com with a link to this thread along with the account information.
Reply all
Reply to author
Forward
0 new messages