Money-saving placement exclusion script for Google Ads

With an uncertain economic outlook, now is the time for advertisers to ensure their technology stack includes the right tools and automations to save money in the long run.

Google Ads scripts should be part of everyone’s toolbox, especially since many scripts are available for free.

In addition to many free scripts on top lists like this one and this onehere is a brand new script you can try.

I wrote this with my team to give advertisers a new way to control ad spend on the Display Network.

Ways to Save Money on Google Ads

Advertisers are always looking for an edge over their competitors, and a good way to level the playing field is to spend less for the same results. This means finding and eliminating unnecessary ad spend.

Common ways to eliminate unnecessary spending are to add negative keywords, restrict match types, and add negative placements.

Here’s how to do it manually for each of these techniques:

  • To add negative keywords – Generate ideas by browsing your search term reports for ideas.
  • Restrict match types – If you’re not using automatic bidding, be careful with your keywords and rely more on exact matches and exact phrases than broad matches.
  • Add locations to exclude – See automatic placement reports to find non-converting placements eating into your budget.

Finding placement exclusions for Google Ads

The web is growing rapidly, which means there are more places every day your ads can appear when you participate in the Google Display Network (GDN).

There are more than 36,000 applications added to the Apple App Store every month, and there are more than 250,000 new websites started every day. While not all of them are joining the Google Display Network, with this level of growth it’s hard to keep track of placement exclusions.

Unless you want to play a constant game of molesting and manually review new locations as they are created, you need to identify the patterns that correlate with poor performance and use technology to help weed out the traffic from these types of locations.

Google offers several ways to do this proactively prevent GDN ads from appearing in places you don’t like.

Exclusions can be based on:

  • Sensitive topics – such as pages about tragedies, conflicts or sensational news.
  • Digital Content Labels – similar to movie ratings, but for sites.
  • Types of video content – such as live streams or embedded videos outside of YouTube.

The script shared in this article provides another way to exclude locations.

While it cannot proactively prevent all impressions, it can add a negative location as soon as a new location is detected in the automated location report.

Location reports

The script analyzes the details of all locations in the Detailed Locations report.

This is the query you can use with GAQLthe Google Ads query language, to search for placements:

SELECT detail_placement_view.display_name, detail_placement_view.placement, detail_placement_view.placement_type, detail_placement_view.resource_name, detail_placement_view.target_url, detail_placement_view.group_placement_target_url FROM detail_placement_view

The data might look like this when you export it to a Google Spreadsheet:

Screenshot of Google Sheet, October 2022

Note that the placement on line 12 in the screenshot uses the Arabic script for the video name.

That’s what this script will look for and add as a negative location.

If your language uses a non-Latin script, you simply need to change the settings and allow your ad to show for a placement like line 12 and exclude all others that use the Latin character set.

Language targeting on the Google Display Network

You might be wondering why advertisers wouldn’t just use language targeting to prevent their ads from showing alongside content that uses a different script in their language.

The problem is that when you’re targeting a language, it’s not a very strict criteria. A user will match the targeted language as long as they have recently interacted with an app or website in that language.

This doesn’t mean they have to view a site or video in that language when your ad appears.

google says:

“On the Google Display Network, Google Ads may detect and examine the language of pages or apps someone is viewing or has recently viewed to determine which ads to display.”

So, if a user only reads a few English web pages with Latin script, but spends most of their time reading sites in Thai script, they may still see ads targeting English.

This script fixes this problem by making the targeting stricter.

This gives advertisers additional control, and is generally a welcome thing in an age of ever-increasing ad engine automation, a subject I wrote an entire book on this year.

Targeting Unicode characters with a Google Ads script

Similar to language targeting, you can use ad scripts to detect when an ad is showing on a placement with a title using a different Unicode character set and block that placement from showing your ad again.

Here is what the script does.

It detects when your ad is shown with a video, app, or website that has content in a different character set than you want.

The script then excludes locations whose names are not in the desired character set.

For example, a placement with the title ‘انشاء حساب جوجل ادوورد مجانا للمبتدئين وطريقة ربطة مع القناة Google Adwords | كنز الربح من اليوتيوب’ uses the Arabic script rather than the Latin character set and can be defined as negative placement.

Use this technique with caution, however.

There is nothing wrong with showing your ad to users whose language is in a different script. For example, they may see your ad because they accessed your remarketing list and are, in fact, a very good lead.

So how does this ad script find placements using non-Latin characters?

It is based on identifying Unicode character sets, which are a way for computers to render the different characters associated with different alphabets.

I’m used to the az alphabet used in English as well as my native language Dutch, and it’s called the Latin alphabet. But many languages ​​use entirely different characters, like Hebrew, Thai, Japanese (hiragana), etc.

Unicode is how computers encode these different characters.

In Google Ads scripts, which are closely related to JavaScript, we can use regex functionality to detect which Unicode character set a character corresponds to.

The scenario

Download the scenario.

Copy and paste all the text from the code on the link into a new script in Google Ads, where you first delete all the sample code that the new script loaded with.

Here is a video that explains how to use the script.

Script Parameters

After copying and pasting the script into an individual Google Ads account, tell it which Unicode character sets you want your ads to serve, for example for Latin.

Then give a name to the shared location exclusion list that the script should use for new exclude locations it discovers.

After previewing the script, you will see that a new shared exclusion list is created.

If there are ad placements whose titles use an unauthorized Unicode character set, these will be added as negative placements to the newly created shared exclusion list.


Two things a lot of advertisers love: saving money and taking back control of automated systems.

Scripts like the one in this article help you do both.

If you have a script idea that could help many advertisers, please don’t hesitate to contact me.

This script was born because someone asked me for help with their idea.

More resources:

Feature image: Dean Drobot/Shutterstock

Comments are closed.