YouTube Kids Channel Cleaner
Automatically identifies and excludes YouTube channels from your video and Performance Max campaign placements based on 'Made for Kids' status, blacklisted keywords in video titles, tags, channel names or descriptions, and video/channel language. PMax channels are excluded at account level (the only level PMax honors).
by Dmytro Tonkikh·chiliad.io
Overview
YouTube Kids Channel Cleaner scans your YouTube placement report for new video and channel placements, fetches metadata via the YouTube Data API, and checks each one for 'Made for Kids' status, blacklisted keywords (in video titles, tags, channel names and optionally descriptions), blocked/not-allowed languages, and blocked/not-allowed channel countries. Matching channels are bulk-uploaded to an exclusion placement list. With INCLUDE_PMAX enabled the script also scans Performance Max placement data and, because PMax only honors account-level exclusions, flagged PMax channels are excluded account-wide via customer negative criteria; SYNC_LIST_TO_ACCOUNT additionally mirrors the whole exclusion list into account-level exclusions each run (add-only, whitelist respected), so historic exclusions start gating PMax too. All processed placements are logged to a Google Sheet with review metadata (language, Made-for-Kids flag, YouTube category, impressions and cost) so you can spot new exclusion candidates, and a 'whitelist' sheet lets you protect channels from ever being excluded while a 'blocklist' sheet always excludes listed channels when they appear. Preview mode is fully safe: it shows what would be excluded without writing any files or applying exclusions.
Setup
- 1In your Google Ads account, go to Tools → Bulk Actions → Scripts.
- 2Click the + button to create a new script and paste the code.
- 3Enable the YouTube Data API in the script's advanced APIs section.
- 4Authorize the script when prompted (it needs access to Google Drive, Sheets, and YouTube).
- 5Optionally use Preview first — it lists what would be excluded without applying or saving anything.
- 6On the first real run the script auto-creates a Google Drive folder structure ('🤖 chiliad scripts / {Account Name} / YouTube Channel Cleaner'), a checked-IDs file, and a summary spreadsheet with 'results', 'tags', 'whitelist' and 'blocklist' sheets.
- 7Add unwanted keywords to the 'tags' sheet (one per row) — e.g. 'kids', 'nursery', 'cartoon'. Matching is case-insensitive; if the sheet is empty, keyword filters are skipped.
- 8
Configuration Variables
| Variable | Default |
|---|---|
CHECK_MADE_FOR_KIDS | true |
CHECK_VIDEO_TITLE | true |
CHECK_VIDEO_TAGS | true |
CHECK_CHANNEL_TITLE | true |
CHECK_VIDEO_DESCRIPTION | false |
Expected Output
Link to main file: https://docs.google.com/spreadsheets/d/... Link to all checked videos: https://docs.google.com/spreadsheets/d/... 42 new video placements and 3 new channel placements to check. Negative channel KidsChannel - UC... Reason: Content for kids Negative channel CartoonWorld - UC... Reason: Video title contains (cartoon,animation) Negative channel RuGaming - UC... Reason: Blocked language (ru) Account-level exclusions (PMax channels): 2 added, 0 failed. Account-level exclusions (list mirror): 12 added, 0 failed. Checked-IDs file has been updated.
Notes
The script requires the YouTube Data API to be enabled in the script's advanced APIs. It processes placements in batches of 50 to stay within API quota limits. Channels are excluded at the channel level, not individual video level. Preview mode never writes files or applies exclusions, so previewed placements are still processed on the first real run. Language is read from YouTube metadata (video default audio language, or the channel's default language for channel placements); many videos have no language set — those are never excluded by the language filter. Country comes from the channel's snippet.country (looked up per channel, batched); channels without a country are never excluded by the country filter. The 'checked' log records every processed placement with Language, Country, Made for Kids, Category, Impressions, Cost, check date and a PMax column showing which placements were seen in Performance Max — sort or filter it to find new exclusion candidates and feed them back into the 'tags' sheet, 'blocklist' sheet or language config. Performance Max placements come from performance_max_placement_view, which reports impressions only — the Cost column shows 0 for PMax-only placements, and PMax placement data can lag a day or two behind (relevant with the default LOOKBACK_DAYS of 1). PMax ignores placement exclusion lists, so channels seen in PMax placements are excluded at account level via customer negative criteria; Google caps account-level exclusions at 65,000 per account. The list mirror is add-only and idempotent: it never removes account-level exclusions, skips whitelisted channels, and channels flagged from regular video placements are picked up by the mirror on the next run (the bulk upload that feeds the list is processed as an asynchronous job).