How to exclude automatically Youtube channels?

1,229 views
Skip to first unread message

Maria Barron

unread,
Feb 18, 2020, 6:51:19 PM2/18/20
to Google Ads Scripts Forum
Hi! I would like to exclude automatically Youtube channels but I get this error "This type of criterion cannot target YouTube websites" I've tried save Youtube Channel's in a Placement List called "Youtube Channel Exclusion"

This's the code

function main(){
  searchByKeyword();
}

function searchByKeyword() {
  
  var urlExclusion = [];
  var videoId= [];
  var snippet= [];
  var videoCampaignIterator = AdsApp.videoCampaigns()
      .withCondition("CampaignStatus = ENABLED")
      .get();
 
  while (videoCampaignIterator.hasNext()) {
    while (videoCampaignIterator.hasNext()) {
      var videoCampaign = videoCampaignIterator.next();
      var id = videoCampaign.getId();
      
  var results = YouTube.Search.list('id,snippet', {q: 'Orso', maxResults: 50, type: 'channel'});
  for(var i in results.items) {
    var item = results.items[i];
    Logger.log('https://www.youtube.com/channel/%s Title: %s', item.id.channelId, item.snippet.title);
    videoId.push(item.id.channelId);
    snippet.push(item.snippet.title);
  }
  
}
  }
  
   for (var i = 0; i < videoId.length; i++) {
       var excludedPlacementList = AdWordsApp.excludedPlacementLists().withCondition('Name = "Youtube Channel Exclusion"').get().next ();
       excludedPlacementList.addExcludedPlacement("youtube.com/channel /"+videoId[i].toString());

  }
}
  

Is there a way to modify the script to make it useful or use an other script for this task?

This would be an awesome help!

Google Ads Scripts Forum Advisor

unread,
Feb 19, 2020, 12:58:58 AM2/19/20
to adwords-scripts+apn2wqc04kbdoc4x...@googlegroups.com, adwords-scripts+apn2wqc04kbdoc4x...@googlegroups.co, adwords...@googlegroups.com
Hi Maria,

Thank you for your question.

For excluding YouTube websites, we currently do not have an available sample Script, however, I would recommend that you use the YouTubeChannelBuilder.exclude() instead as this should be more appropriate for your requirement.

Let me know if this helps.

Best regards,
Peter
Google Ads Scripts Team

ref:_00D1U1174p._5001UV1TaA:ref

Maria Barron

unread,
Feb 25, 2020, 1:50:42 PM2/25/20
to Google Ads Scripts Forum
Thank you, but I'd like exclude negative placemets using negative placement list

Google Ads Scripts Forum Advisor

unread,
Feb 25, 2020, 4:36:14 PM2/25/20
to adwords-scripts+apn2wqc04kbdoc4x...@googlegroups.com, adwords-scripts+apn2wqc04kbdoc4x...@googlegroups.co, adwords...@googlegroups.com
Hi Maria,

You can find the scripts reference for excluded placement lists here.

Hope this helps.

Regards,
Matt

Dmytro

unread,
Jan 21, 2021, 7:21:35 AM1/21/21
to Google Ads Scripts Forum
Hello 

you can try my solution - http://chiliad.agency/en/youtube_cleaner

It cleans placements by their content

Google Ads Scripts Forum Advisor

unread,
Jan 21, 2021, 9:08:45 PM1/21/21
to adwords...@googlegroups.com

Hi Dmytro,

Thank you for extending your knowledge to this Google Ads Scripts community.

Let us know if you have any questions/concerns related to Google Ads Scripts. We'll be happy to assist you.

Regards,

Google Logo
Mark Kevin Albios
Google Ads Scripts Team
 


ref:_00D1U1174p._5001UV1TaA:ref
Reply all
Reply to author
Forward
0 new messages