English Español Deutsch Français Italiano Português (Brasil) Русский 中文 日本語
Submit post
Go to Blog

How to Exclude Children’s Channels from YouTube Advertising

The Wow-Score shows how engaging a blog post is. It is calculated based on the correlation between users’ active reading time, their scrolling speed and the article’s length.

How to Exclude Children’s Channels from YouTube Advertising

Dmytro Tonkikh
How to Exclude Children’s Channels from YouTube Advertising

In the middle of March, a number of major advertisers left YouTube because their pre-roll ads (paid videos shown before the main content is played and can be skipped after 5 seconds) were placed in videos with offensive content. However, in this article, we would like to talk about another important topic – unintended demonstrating pre-rolls in children's content.

The problem is that even with correct targeting settings for an adult audience, a huge amount (up to 90% in some cases) of impressions is given to children's channels. This is due to the fact that parents use the "adult" accounts on their devices, both mobile and desktop, to show cartoons and educational videos to their kids.

Naturally, advertisers do not want to spend their budgets on children who simply watch pre-rolls, because this has almost no effect on sales. Such videos and channels can be excluded using negative keywords, but it is time-consuming and difficult and will not exclude all the channels and videos.

Many non-popular children's channels and videos continue to show pre-roll ads because they share a common, childish name or have an inadequate description, but they are still watched by many children. There is a way to automate the search and exclusion of such channels using AdWords scripts, which is provided below.

Problem Solution

Google AdWords allows you to create your own scripts on JS to manage your advertising account. They are based on Google Apps Scripts and their main advantage is an integration with other Google services, such as Google Drive, Spreadsheets, YouTube, Analytics, BigQuery, etc., as well as the ability to work with third-party APIs. For example, you can use YouTube Data API v3 to find the video for an ad placement.

It turned out that children videos are combined not by names, but by their tags. After modifying the script for YouTube video search, similar tags for various children videos in English, Russian, and Ukrainian were found and saved in Google Spreadsheet for further use. The file is public, but it is recommended to make a copy of this file and save it on your Google Drive before setting up the script and replace the file id in the script with a new one.

Important Details

  • We get all the links with YouTube placements and videoId from the previous date from URL_PERFORMANCE_REPORT:

var report = AdWordsApp.report(
'SELECT Url ' +
'WHERE CampaignName CONTAINS "Video" ' +
 var rows = report.rows();
while (rows.hasNext()) {
var row = rows.next();
var videoId = row['Url'].toString().replace('www.youtube.com/video/','');

  • Requests are sent to YouTube with each video id in the loop. Tags and video channel IDs got in response are checked whether they match anything from the collected library with the children's tags:

for (var i = 0; i < videoList.length; i++) {
var results = YouTube.Videos.list('snippet', {id: videoList[i]});
try {
  if (results.items[0].snippet !== undefined) {
  var channelId = results.items[0].snippet.channelId;
  var tags = results.items[0].snippet.tags;
  if (uniqueChannel[channelId] !== true){
  for (var k = 0; k < tags.length; k++) {
  if (tagsObj[tags[k]] !== undefined) {
  uniqueChannel[channelId] = true;
  Logger.log("Add to the library with extensions - " + channelId);
  } else {
} catch (e) {

If any of the video tags matches the tags in the library, the ID of the video channel will be sent to the array for exclusion (if it has not already been added via another video from the same channel).

Once all the videos have been checked, run the loop to add all the channels to the list of excluded sites to your AdWords account. A list with a name identical to the one in the script (here – "Video_channels") needs to be created in advance. The limit for the list of excluded sites is 65,000, so there should not be any overflow problem.

var excludedPlacementList = AdWordsApp.excludedPlacementLists().withCondition('Name = "Video_Channels"').get().next();
 for (var d = 0; d < channels.length; d++) {

Issues Occurred

The solution provided above seemed to work correctly, but some issues still occurred. When using this script, we faced the following problem. The script did not manage to process all the videos from the previous day since there was a 30-minute limitation by AdWords. So, the new exceptions were not added.

In addition, it was necessary to add videos as often as possible to save the budget by targeting the right audience. Unfortunately, even after adding a video to the list of exceptions, they, according to our experience, did not start working immediately. Google technical support estimated that it would take up to 2 days, usually less. Therefore, if you have a list of channels collected by the script, it is recommended to add them to the exception list in advance.


It seems reasonable to run the script every hour and does not check the videos that have been previously checked or else the script will reach the 30-minute limit in the middle of the day. The solution was designed using this script. It was a bit more complicated as compared with the first version of the script, but the results were excellent.

We added the functionality to save txt-files with the checked content to Google Drive. The IDs for checked content were enrolled in the file and later they were compared with the new IDs. The comparison was made using a difference method from the open-source Undercode.js library.

As the output, we got an array of exclusively new videoId for the last hour, which we checked according to the scheme developed in the first version of the script for the occurrence of tags. And after the script was completed, we added all the videos for the current day to the same txt-file.

Setting Up the Script

  1. Specify the name of the file to be created on Google Drive:
    var dataFile = "videoIds.txt";
    If there is no such a file, it will be created automatically.

  2. Select the campaigns you want to check:
    'WHERE CampaignName CONTAINS "(Video)"
    AWQL syntax is provided in the AdWords Help.

  3. Replace the file id in Google Spreadsheet:
    var spreadsheet = SpreadsheetApp.openById('11PMGc70yLE88Npi47Hwb6W36Y8yjw2N2CdXXLgdK12o');

  4. In the AdWords interface, create the general list of excluded placements:
    var excludedPlacementList = AdWordsApp.excludedPlacementLists().withCondition('Name = "Video_channels"').get().next();
    and insert its name instead of "Video_channels".

  5. Enable YouTube in extended APIs.
    After the first views, enable YouTube API in Google Developers Console. The link will be in the error log.

  6. Set an "Every Hour" schedule for script operation.

And voila!

Final Comments

As a result, we created a script that checked YouTube channels with children's video content every hour without reaching the time limit. You can also customize the script to any topic by adding new tags to the Spreadsheet file. The code for the updated script was posted here. Your questions and suggestions are kindly appreciated.

Keep in mind that sometimes video channels with other content also falls in the exception list, but this happens rarely. There are two main reasons for that. The channel owners share content for children as well as other types of content. And sometimes, video channels may also use the wrong tags to expand their audience.

According to our observations, after you start using the script, the viewing rate (VTR, view-through rate) will significantly decrease, as adults press the "skip" button more often than children, but this way, your ad will be shown to the relevant audience.

Use the script and place your ads on the right channels!

Dmytro Tonkikh

An experienced member who is always happy to help.

PPC advertising specialist at Promodo. He has been creating content and launching PPC campaigns for Ukrainian and international companies for 3+ years. Befriend him on Facebook.
Share this post


Aniruddha Mishra

Either just recently joined or is too shy to say something.

Can you guys please post a video guiding us through the process?

Either just recently joined or is too shy to say something.

Unfortunately, this script is not working. You can find the reason on google developer blog
"We are rolling out a change to the way placements work when specifying YouTube URLs. Starting on August 14, 2018, using generic placements to specify YouTube channels or videos is going to be disallowed and will result in an error."
Charlie Chatz

Occasionally takes part in conversations.

There isn't another guide like this on the web and it would be great if there where clear instructions of how to set up the correct working script

Either just recently joined or is too shy to say something.

Anyone have a copy of the spreadsheet? There were over 400 entries before and now just 200+

Either just recently joined or is too shy to say something.

My file comes back blank. This is not explained very well.

Either just recently joined or is too shy to say something.

Hi Dmytro,
Very good idea to generate channel exclusion list with children's movies. Unfortunately there is no exact instruction how to run it. Step-by-step step-by-step creativity would be like a Christmas gift for those who spend their money unnecessarily on the Google AdWords Video.
I have error: We're sorry, a server error occurred. Please wait a bit and try again. (line 17)

Either just recently joined or is too shy to say something.


Thank you for putting this together.

However it's quite complicated to setup. You reference the script from GitHub way further down the page. Yet you start talking about how to edit it at the start.

I find this script difficult to implement and teeming with errors. Is there an english version of the script you've posted?
Du hoc nhat ban

Occasionally takes part in conversations.

Many thanks !

Either just recently joined or is too shy to say something.

Thanks Dymtro
Arunava Dasgupta

Either just recently joined or is too shy to say something.

New generation in the world are educated(65%) are they are using smart phone, Tablet,I Phone of different companies. Hence Young generation are computer sabby. I am very hopefull that those young generation (18-35) will make NEW WORLD/NEW INDIA. I feel they are not selfish.They help Human beings, dress well. attend office in time, work very hard ,honestly to earn money so that they can enjoylife.
Also they are nature loving, do good cooking at home,Help parents, avoide bad people, donot mixed up with stangers, talk less -work more. very decipline. Thoughts are very clear.decision makers.
Arunava Dasgupta

Either just recently joined or is too shy to say something.

Make my website free

Occasionally takes part in conversations.

Thanks for sharing. That is really interesting article with lot of information. Thanks for sharing.
Du hoc nhat ban

Occasionally takes part in conversations.

I'm newbie, i'm trying with our new website in vietnam. Thank you very much.

Send feedback

Your feedback must contain at least 3 words (10 characters).

We will only use this email to respond to you on your feedback. Privacy Policy

Thank you for your feedback!

Community Ranking System

Our SEMrush community rank reflects the level of your professional recognition in our community. We value quality contributions, so highly ranked members will get valuable incentives. Take part in discussions, write posts and speak on webinars, be friendly and helpful, and you will eventually get to the top of the ladder.

  • Newcomer
    Either just recently joined or is too shy to say something.
  • Enthusiast
    Occasionally takes part in conversations.
  • Helper
    An experienced member who is always happy to help.
  • Master
    A veteran community member.
  • Pro
    Asks great questions and provides brilliant answers.
  • Expert
    Provides valuable insights and adds depth to the conversation.
  • Guru
    A bearer of digital marketing wisdom.
  • Superstar
    Knows everything… well, almost.
  • Legend
    Getting here is not easy at all!