How do you automate placement exclusions with Google Ads scripts?
Part of Google Ads placements

The short answer
Google Ads scripts can exclude placements automatically: a script reads where ads showed through a GAQL report, applies written rules, and adds matches to an ad group, a campaign or a shared excluded placement list. Safe setups preview first, protect approved sites, cap changes per run, log each exclusion with its rule, and keep a person approving the rules.
Key takeaways
- The scripts API documents exclude() on its placement builder and addExcludedPlacements() on shared excluded placement lists, so exclusions can be written by code.
- Google warns that Where ads showed performance data is generally not statistically significant, which makes brand fit rules safer to automate than performance thresholds.
- Preview mode changes no campaign data, but emails and spreadsheets still update, so a script needs its own guard for outside writes.
- Each run leaves a Changes log and a Logs output; a script's own log line should add the rule, the window and the reason.
Can Google Ads scripts exclude placements automatically?
Yes. Google's help page on using scripts (opens in a new tab) describes them as JavaScript code that can create, edit or remove items in an account, and says a script can be scheduled to run once, daily, weekly or monthly at a certain hour. For placements, the scripts reference (opens in a new tab) gives the placement builder an exclude() method, documented as "Builds the excluded placement." The table lists the pieces a placement exclusion script uses.
| Object or method | What the reference says it does | Use in an exclusion script |
|---|---|---|
| AdsApp.search() with GAQL | Runs a query naming fields, metrics and conditions, backed by the Google Ads API | Reads served placements for a date window |
| group_placement_view | Shows where ads served on the Display Network and YouTube, targeted or found automatically | The source rows a rule checks |
| PlacementBuilder.withUrl().exclude() | withUrl() is required; exclude() builds the excluded placement | Excludes a site in one ad group or campaign |
| ExcludedPlacementList.addExcludedPlacements(urls) | Adds a list of shared excluded placements to the list | Adds approved exclusions to a shared list in one call |
| ExcludedPlacementList.campaigns() | Returns the search and display campaigns the list has been applied to | Logs which campaigns an addition affects |
| Campaign.addExcludedPlacementList() | Adds an excluded placement list to the campaign | Attaches the shared list to a new campaign |
Two details shape the code. The Google Ads API field reference (opens in a new tab) marks group_placement_view.placement as selectable but not filterable, so the script selects the rows in the window and applies its rule in JavaScript. And the scripts limits page (opens in a new tab) says the standard campaign selector filters out Video campaigns, which need their own selector.
Which rules make sense for automated exclusions?
Start from Google's own warning. Its Where ads showed page (opens in a new tab) says that because of the large number of placements and relatively low impressions per placement, performance data in the report is generally not statistically significant, and that over optimizing on it can severely limit the inventory available to a campaign. A script that excludes sites below a click rate threshold automates exactly that mistake. Rules about what a placement is travel better than rules about how it performed last week.
| Rule type | Strengths | Limits |
|---|---|---|
| Sync a reviewed blocklist from a sheet | A person decided each domain; the script only applies it everywhere, on schedule | Only as current as the sheet; a typo excludes the wrong site |
| Placement type rule, such as apps when the brief is web only | Reads a documented field (placement_type, with values such as WEBSITE and MOBILE_APPLICATION) | Blunt: it removes a whole class, including good inventory in it |
| Name pattern rule, such as unformatted app placements | Google's report page says these names come from new apps, delisted apps and apps not yet in a store that are testing ads | Patterns drift; a careless one catches legitimate names |
| Performance threshold rule | Easy to write and to explain | Google calls the underlying data generally not statistically significant; safest as a flag for review, not an exclusion |
How do you avoid excluding good sites by script?
Six safeguards for a placement exclusion script
- Protect the approved list. Load the client's inclusion list and skip any candidate on it, whatever the rule says, and log the skip.
- Cap each run. Stop after a set number of exclusions and warn in the log, so a broken rule cannot empty the network in one night.
- Run in preview first. Google's preview page (opens in a new tab) says preview makes no changes to the actual campaign data and shows the changes that would have been made.
- Guard outside writes. The same page says only AdsApp calls are previewed: an email still sends and a spreadsheet still updates. Read the execution info and skip outside writes during preview.
- Fix the time zone. The dates guide (opens in a new tab) says the default is always America/Los_Angeles, whatever the account's time zone, so format dates with the account's own zone.
- Respect the residual row. The placement views guide (opens in a new tab) says low activity placements may be rolled into a "Total: Other" row, so a script never sees them and must not treat Other as a domain.
Shared lists add one more check. Google's help pages disagreed when checked in October 2026: one says exclusion lists can only be created in manager accounts, another that each client account can have up to 20; one gives 250,000 exclusions per manager list, another 65,000 per list. Confirm the limits in the account before a script writes to a list near its ceiling, and have the script log the list's size after each run.
Time limits matter too. The limits page says scripts in advertiser accounts run for at most 30 minutes and that changes made before cancellation are applied. A script that times out halfway leaves half its exclusions in place, so it should write its log line as each exclusion is made, not at the end.
How should script changes be logged?
Google keeps two records. The execution logs page (opens in a new tab) says the Changes log shows each change to Google Ads entities with the entity, type of change, value before and after, and errors, while the Logs output shows text the script prints with console.log(), console.warn() or console.error(). The limits page adds that logging output is truncated at 100Kb. Account change history (opens in a new tab) covers the last 2 years and filters by Tool.
| Field | Example content | Why it matters |
|---|---|---|
| Run time and zone | Date and hour in the account's time zone | Matches change history without the Los Angeles default |
| Rule ID and version | The rule's name and its version number | Shows which rule made the call after a rule changes |
| Placement and type | The placement string and placement_type | Lets a reviewer open the site or app |
| Window and level | Date range read; ad group, campaign or shared list written | Explains scope when a site is disputed |
| Approver | Who marked the row approved, for a two step setup | Keeps a person on record for each exclusion |
Who should approve automated exclusions?
Google's getting started guide (opens in a new tab) requires someone to click Authorize so the script can access the account on their behalf, once per script, and recommends previewing before running. That is the only approval Google builds in. The limits page adds that an account can hold 250 authorized scripts, after which an older one is deauthorized until reopened.
The rest is the team's design. A workable split gives the account owner the rule set and the cap, the planner who knows the brief the review sheet, and the person who authorized the script the duty to read its logs. Rule changes go through the same review as the first launch, because a one word change to a pattern can widen what the script removes.
Before a placement exclusion script goes on a schedule
- The rule set is written down, versioned and signed by the account owner.
- The approved inclusion list is loaded as a protected list.
- A cap per run is set and a warning is logged when it is reached.
- A preview run was read line by line, with outside writes skipped.
- Dates are formatted in the account's time zone.
- Each exclusion writes a log line with rule, window, level and approver.
- Someone is named to read the Changes log after each scheduled run.
What does a placement script look like on a real account?
Fictional example
A hot tub dealer in Columbus and Dayton
An unnamed dealer of hot tubs and swim spas in Columbus and Dayton, Ohio, runs a Display campaign in English. One ad group targets an approved list of local news, home improvement and backyard design sites. A second ad group uses audience targeting, so its ads reach placements nobody chose.
The agency writes two scripts. The nightly reader queries group_placement_view for the audience ad group over the last 14 days, formats dates in Eastern time, and checks three rules: domains on the planner's reviewed blocklist, app placements, since the brief is web only, and unformatted app names. Candidates go to a review sheet with the rule that caught each one; sites on the approved list are skipped and logged.
Each morning the planner marks rows approved or rejected. The second script adds approved rows to the shared exclusion list with addExcludedPlacements(), stops at its cap, and logs the campaigns the list reaches. No performance figures are implied.
How does PlacementGraph build the starting list before a script runs?
Frequently asked questions
Why did my spreadsheet change when I only previewed the script?
Google's preview page says preview mode only affects calls that use AdsApp. Other services run normally, so an email sends and a spreadsheet updates whether the script was previewed or run. Check the execution info for preview mode and skip outside writes when it is set.
What happens if a placement script runs out of time?
Google's limits page says scripts in advertiser accounts are cancelled after 30 minutes, and changes made before cancellation are applied. Manager account scripts that use executeInParallel with a callback can run up to 60 minutes. Log each exclusion as it is made so a partial run is easy to read.
Can one script manage placement exclusions for several client accounts?
Yes, from a manager account. Google's limits page says an Ads Manager script using executeInParallel can process up to 50 accounts, each with its own quota. Keep each client's protected list separate, since one client's approved site may be another's exclusion.
Why doesn't my script find placements from Video campaigns?
Google's limits page says the standard campaign selector, AdsApp.campaigns().get(), filters out Video and Shopping campaigns. Use the dedicated videoCampaignSelector instead. The same page says reports, such as GAQL queries of placement views, are not subject to entity limits.
Sources
- Using scripts to make automated changes (opens in a new tab)Google Ads Help
- AdsApp.PlacementBuilder (opens in a new tab)Google for Developers, Google Ads Scripts
- AdsApp.ExcludedPlacementList (opens in a new tab)Google for Developers, Google Ads Scripts
- AdsApp.Campaign (opens in a new tab)Google for Developers, Google Ads Scripts
- Reporting (opens in a new tab)Google for Developers, Google Ads Scripts
- group_placement_view (v26) (opens in a new tab)Google for Developers, Google Ads API
- Track ad placement and performance (opens in a new tab)Google for Developers, Google Ads API
- Preview Mode (opens in a new tab)Google for Developers, Google Ads Scripts
- Working with Dates and Times (opens in a new tab)Google for Developers, Google Ads Scripts
- Execution Logs (opens in a new tab)Google for Developers, Google Ads Scripts
- Limits (opens in a new tab)Google for Developers, Google Ads Scripts
- Get started (opens in a new tab)Google for Developers, Google Ads Scripts
- About the Where ads showed report (opens in a new tab)Google Ads Help
- Review your account history (opens in a new tab)Google Ads Help
- Exclude placements at the account level (opens in a new tab)Google Ads Help
- Exclude specific webpages and videos (opens in a new tab)Google Ads Help
- Use placement exclusion lists across your accounts (opens in a new tab)Google Ads Help
- How to use brand suitability features in Performance Max (opens in a new tab)Google Ads Help
Researched and written by PlacementGraph Research. Read how we research, source and update these pages. Corrections: diana@placementgraph.com.