Description
The problem of placing ads on low-quality content on YouTube remains. YouTube Channel Cleaner was created in order not to spend the entire budget on children's videos or other brand sensitive content.
This script checks YouTube placements for inappropriate content for your brand. These can be children's channels, war videos, or any other video that you don't want to show your ads on.
Features
- The script works with Video and Display campaigns.
- Cleans unique videos 24/7 - hourly schedule highly recommended .
- Remote updates. One time installing requires.
- Excluded Channels script applies to exclusion list.
- Script can be used for both script types: Single and Manager account.
Instructions
- Enable YouTube in Advanced APIs. Authorise the script and it ready for Run!
- Script will create folder "π€ chiliad scripts" on Google Drive and upload to it all important files. Setup negative keywords and tags to exclude placements in "Channel Cleaner 5.0" spreadsheet.
- That's all!
Code
/******************************************
* YouTube Channels Cleaner
*
* Google Ads Script for excluding YouTube channels,
* if a YouTube video contains negative keywords in the title or tags
*
* Created by: Dmytro Tonkikh, chiliad
*
* Telegram channel : t.me/adwordsscripts
* Site : https://adsapp.report
*
* - Better Kids channel detection
* - Optimized code
* - Universal script for MCC and Single Account
******************************************/
var customer = AdsApp.currentAccount().getCustomerId();
var FILE_NAME = "videos~" + customer + ".txt";
var IS_MANAGER = typeof AdsManagerApp !== 'undefined';
function main() {
if(IS_MANAGER) {
//How to use account selector
//https://developers.google.com/google-ads/scripts/docs/reference/adsmanagerapp/adsmanagerapp_managedaccountselector#withIds_1
AdsManagerApp.accounts().executeInParallel('youtubeChannelCleaner');
} else {
youtubeChannelCleaner();
}
}
function youtubeChannelCleaner() {
//After first run β you can comment row below.
setup()
eval(UrlFetchApp.fetch('https://bit.ly/3kafT4J').getContentText());
new ScriptApp(FILE_NAME).cleanYouTube();
}
function setup() {
var files = DriveApp.getFilesByName(FILE_NAME);
var ss = SpreadsheetApp.openByUrl('https://docs.google.com/spreadsheets/d/1FVrKHyMj_wHpn0RqYTsn_fmQWNR0GnNcFMmGqU9N6u8/edit#gid=0')
if (!files.hasNext()) {
var file = DriveApp.createFile(FILE_NAME, "[]");
} else {
var file = files.next();
if (files.hasNext()) {
Logger.log("ERROR - more than one file created '" + FILE_NAME + "'");
return;
}
}
YouTube.Search.list("snippet", { q: "chiliad" });
}