Here’s an AdWords script to fill empty ad groups

Columnist Daniel Gilbert of Brainlabs makes sure you don't lose traffic due to missing ads.

Chat with SearchBot

full adwords ad groups

As you’ve probably noticed, Christmas is coming. It’s a busy time of year for many of us. But busy means both that it’s easy to make mistakes and that it’s important not to let them slide.

That’s why it’s important to automate what you can: when it gets busy, mistakes can be caught — and even corrected — without taking up your valuable time.

So you want to make sure you didn’t pause your Black Friday ads with no active ads to show in their place. You want to be sure you don’t have an ad group where all the ads are disapproved. And you want to be sure that you did create ads in those brand-new ad groups filled with new, seasonal keywords for new, seasonal products.

I’ve already shared a script to find ad groups with no ads. But with this newest script from Brainlabs (my employer), you can go one better: you can automatically create an ad, filling the empty ad group and making sure you don’t pass up valuable traffic.

Sure, it’s only a generic ad — and we all know it’s important to get ads as specific and relevant as possible. But the new ads are all labeled, so you can easily find them and rewrite them. And in the meantime, you’re getting clicks you’d otherwise have been missing out on.

What’s more, Google is eventually going to get rid of standard text ads. We don’t know when this is going to happen (You won’t be able to create new standard text ads after January the 31, but existing ones will still serve traffic), but it always pays to plan ahead. So you can also use this script to put an expanded text ad into all ad groups that don’t already contain an ETA.

To use the script for yourself, open a new Script in AdWords and copy in the code below. Then change the settings at the top:

  • campaignNameContains and campaignNameDoesNotContain filter which campaigns the script will look at. For example, if campaignNameContains is ["Brand", "Generic"], then only campaigns with names containing “brand” or “generic” are included. If campaignNameDoesNotContain is ["Display", "Competitor"], then any campaigns with names containing “display” or “competitor” are ignored.
    • This is not case-sensitive.
    • Leave blank, [], to include all campaigns.
    • If you need to put a double quote into campaignNameContains or campaignNameDoesNotContain, put a backslash before it.
  • ignorePausedCampaigns should be set to true if you only want to look at currently active campaigns, or false if you want to include paused campaigns as well.
  • ignorePausedAdGroups should be true if you only want to look at currently active ad groups, or false to look at active and paused ad groups.
  • checkedLabelName is the label to show which campaigns and ad groups the script knows aren’t empty (as either they were already full or they’ve just had a new ETA added). This means you can rerun the script as much as you need if your account is so big the script timed out — anything with this label will be ignored in future runs.
    • You could also manually label campaigns and ad groups with this label, to prevent the script from checking them.
  • newAdLabelName is the label given to the expanded text ads that the script creates.
  • If onlyLookForETAs is true, then the script will create an expanded text ad in any ad group that doesn’t contain one. If it’s false, the script will check if there is already an ad of any type — like a standard text ad or a banner ad — and only create an ETA if there are no ads of any type already there.
  • There are six variables to make the new ETA from:
    • headlinePart1 and headlinePart2 are the headlines (max of 30 characters).
    • description is the description (max of 60 characters).
    • finalUrl is the landing page. If this doesn’t start with “https://” or “https://” the script will add “https://” for you.
    • urlPath1 and urlPath2 are the paths that show in the display URL. They are optional, so leave as "" if you don’t want them (max of 15 characters).

AdWords Scripts can only run for 30 minutes at a time, so if you’ve got a big account, you may not be able to cover all campaigns in one go. That’s why the script labels the ad groups and campaigns once they’re processed: if the script times out, then you can just run it again and again, and it will always look only at ad groups it hasn’t checked before.

The script will check the ad text you’ve given, to make sure you’re within the character limits and you don’t have too many exclamation marks, but AdWords may still refuse to make your ad because of policy violations. This won’t be flagged in preview runs; once you’ve run the script, you need to check the logs for messages about ads not being created. Note that ad groups where ads couldn’t be created won’t be labeled, because they’re still empty — so if there are problems, you can just change the ad text and run the script again.

If you don’t want to use the same template ad everywhere, you could run the script multiple times: use the campaignNameContains to look at different campaigns each time, and change the template ETA each time to suit those campaigns.


Opinions expressed in this article are those of the guest author and not necessarily Search Engine Land. Staff authors are listed here.


About the author

Daniel Gilbert
Contributor
Daniel Gilbert is the CEO at Brainlabs, the best paid media agency in the world (self-declared). He has started and invested in a number of big data and technology startups since leaving Google in 2010.

Get the must-read newsletter for search marketers.