AdWords scripts for editing prices in ads

AdWords Scripts allows account managers to make automated changes, reports, or alerts using a development environment inside the AdWords interface. Scripts is located under “Bulk Operations” after you log into an account. When Google announced AdWords Scripts I didn’t really pay close attention. I didn’t think I’d ever need to use it: alerts are nice, but I look at my accounts every day, so I don’t need an automated tool to tell me what’s going on; reports are great, but clients are typically looking for something very customized that also spans multiple platforms; automated bulk changes can be useful, but the AdWords Editor is great for bulk changes and there isn’t typically enough generalized repetition to necessitate a script. Despite my skepticism, it wasn’t too long before I found a use for scripts for account management.

Many businesses have fluctuating prices for their products/services, which they post online. For ads that advertise these prices, it is difficult to keep up with changes, and if you edit an ad manually you run into a couple problems:

  • The ad could go “under review.” This is an ad status that prevents your ad from showing until an editor has a chance to approve the ad. If you’re editing prices and your ads go under review, you won’t have any ads showing for a period of time.
  • The ad will be “eligible” but not approved before it reaches “approved” status. When an ad is “eligible,” its distribution is negatively affected – not showing on the Search Network or Display Network, or in top highlighted positions on Google’s search results pages.
  • The ad’s history will be erased. Even slightly edited ads start anew with quality scores.
  • It will be much more cumbersome drawing data from pools of deleted and active ads to report on ad performance.

To get around these problems, AdWords offers keyword-level ad parameters. Ad parameters are not shown in the AdWords interface or in the AdWords Editor. The only way to get and set these values is by using the API or scripts. The only values they will accept are numeric values, and they can include currency symbols. (In comparison, Bing Ads has always allowed ad parameters that are editable within the Bing Ads interface and that will allow text as well as numbers.)

To update prices in an ad, you only need to create an ad that uses ad parameters and edit the keyword parameter to display the appropriate price. In this way, you won’t need to delete and create a new ad everytime you need to update prices.  An example of a description line that uses ad parameters looks like this:

Starting at {param1:competitive prices}.

After I had my ads setup with param1 (on pause), I went about setting keyword parameters. This requires AdWords Scripts and a little bit of knowledge of JavaScript. To make it easy, I created ad group level labels, since all of the keywords that should share a certain price were setup in the same ad group. And I setup an associative array that uses the label as a key and the price as the value (sort of like a Hashtable in Java). I used the ad group labels to retrieve keywords that should have a certain price, and set that price for the ad param using an adGroupIterator and a keywordIterator and my array of prices. AdWords provides a bunch of starter code. I’m not posting mine here.

Because the company I set this up for didn’t have a feed of prices, I had to scrape them from their site using regular expressions in a separate Perl script. I didn’t feel comfortable fully automating this process because the structure of the webpage I was scraping could change (though scripts do support http requests, so it should be possible). Even though it is possible to schedule scripts to run, I manually run mine after updating the prices that my other script returns. It still saves me quite a bit of headache. Instead of spending an hour reading prices and editing them through the AdWords Editor, I spend a couple minutes running a couple scripts, without the negative side affects of deleting and posting a new ad.