X
    Categories: GooglePay Per Click

Why the Advanced AdWords Certification Exam Made Me Write An AdWords Happy Hour Script

If the Google Adwords Advanced Certification test hadn’t been multiple choice, I might have failed it. If they had allowed free form answers, I would have taken a very different approach from the answer they wanted to hear.

Of course my common answer was to use scripts, and there wasn’t a single question for which that was the right answer. In fact, I don’t even recall a question where scripts was a possible answer. By comparison, you are expected to know information about API usage, a very complicated process best suited for professional programmers, not just advanced Adwords practitioners.

Personally, I think it’s a huge miss on Google’s part.   Adwords scripts can accomplish fairly simple, elegant solutions to routine problems.

Let’s take for example the concept of ad scheduling. It’s an important concept for anything that’s time sensitive. The common use case is to completely stop showing a campaign during times that are not appropriate. This works great if there’s only on or off that matter.

But imagine the case of a restaurant that wants to promote happy hour and lunch specials. Using just ad schedules, it would need two separate campaigns with two separate schedules. If they always wanted to run a “base” conversion campaign as well they’d need three. Maintenance is now three times as complicated, and data is stretched extremely thin and hard to aggregate. It’s also easy to lose control of budgets unless also employing a shared one between the three. It’s kludgy to say the least.

However scripts can elegantly solve this task by turning on and off ads via labels, but keeping the remainder of the account structure intact.

First we need to label our ads, which is easiest to do within the interface. In this example we could call them “HH” or “Lunch”. Our ad group iterator can then use a condition to select based upon these labels and pause or enable the campaign. To keep the logic simple we can employ separate scripts for each “switch” and not have to have any complicated if then statements or time lookups.

Stating it in my typical framework of what we want to accomplish sounds like this: “Enable ads labeled ‘HH’ and pause those without that label when we run this script everyday around 4 o clock.” The framework telling me that I need to selected based upon Label Names and iterate through them to pause or enable as needed. It’s also telling me to schedule the script.

In code, it looks like this:

var CAMPAIGN_NAME = ‘Chotchkies’;

function main() {

// Set Lables as appropriate

pauseAdsWithLabel(“Lunch”);

enableAdsWithLabel(“HH”);

}

function enableAdsWithLabel(eLabel) {

var adsIterator = AdWordsApp.ads()

// condition could also be STARTS_WITH instead of =

.withCondition(“LabelNames = ‘” + eLabel + “‘”)

.get();

while (adsIterator.hasNext()) {

var ad = adsIterator.next();

ad.enable();

}

}

function pauseAdsWithLabel(pLabel) {

var adsIterator = AdWordsApp.ads()

.withCondition(“LabelNames = ‘” + pLabel + “‘”)

.get();

while (adsIterator.hasNext()) {

var ad = adsIterator.next();

ad.pause();

}

}

A few notes on the code.

First, I don’t actually use the campaign name anywhere in the code, but needed to slip in an Office Space reference somehow. As a result the script traverses the entire account. It’s very possible to actually use a campaign name condition or even an ad group condition to limit the scope.

Second, There’s no need to do anything schedule the script to run when the switch needs to happen on a daily basis. I’d recommend scheduling a copy of the script to run when the events need to reverse, since it’s much easier than trying to add the time logic needed for an hourly run.

Third, there are other ways to accomplish this same task. It’s possible to use a label class and have it return an ads iterator. It might be more “elegant” that way, but much harder to explain. So ignore this part unless you are a real programmer and want to show off.

Finally – Scheduling scripts. This Google makes super easy. In bulk operations, right next to where the script was created, there’s a plainly labeled link to “create schedule”.

To wrap up – you don’t need to know scripts to pass the Adwords exams (yet?), but if you do know them, I think the answers are better than the ones they want you to select.

The following two tabs change content below.

Steve Hammer

President & Co-Founder at Rank Hammer
Steve Hammer is President and co-founder of RankHammer, a full service search marketing agency in Dallas, Texas. Steve's experience in online media and traditional marketing allows a strategic and long-term view of search marketing. He has achieved extraordinary and sustainable results in several competitive online industries often exceeding growth rates in excess of 50% per year. Prior to RankHammer, Steve held a number of exemplary positions including Director of Search Marketing for ACE Cash Express, General Manager for Stir, and a practicing Chemical Engineer for BASF. He holds a MBA from the prestigious Kellogg School of Management. Steve is very active in the Dallas and Search Marketing community, as a former VP on the DFWSEM. He has spoken at numerous meetings and conferences including SES, ClickZLive, SMX Advanced, State of Search, Pubcon, and Interactive Insights Summit.
Steve Hammer :Steve Hammer is President and co-founder of RankHammer, a full service search marketing agency in Dallas, Texas. Steve's experience in online media and traditional marketing allows a strategic and long-term view of search marketing. He has achieved extraordinary and sustainable results in several competitive online industries often exceeding growth rates in excess of 50% per year. Prior to RankHammer, Steve held a number of exemplary positions including Director of Search Marketing for ACE Cash Express, General Manager for Stir, and a practicing Chemical Engineer for BASF. He holds a MBA from the prestigious Kellogg School of Management. Steve is very active in the Dallas and Search Marketing community, as a former VP on the DFWSEM. He has spoken at numerous meetings and conferences including SES, ClickZLive, SMX Advanced, State of Search, Pubcon, and Interactive Insights Summit.