Last week I had the pleasure of returning to Portland, Oregon, site of the last US-based Hero Conf. Some of the locals had heard my talk on Shopping Ads and invited me back to cover the same topic at SEMpdx. They told me this would not be an audience of PPC newbies and since I’d already covered the basics of Shopping Ads, I decided to combine this topic with my perennial favorite: automating AdWords with AdWords Scripts.

I’ll share some of the scripts I wrote for that conference in the hopes that some of you will find these useful and help save you some time.

Find Duplicate Product Targets

Just like we don’t like adding duplicate keywords to accounts, we think it’s a bad idea to accidentally target the same product through multiple product groups. The problem is simple: whenever you accidentally have a duplicate target in AdWords, whether it’s a keyword or a product, this leads to unexpected outcomes.

Say you look at the latest conversion data and realize you’ve been bidding too much for a product so you decrease the bid for its product group. If that same product is also targeted from another product group where the bid is now higher than the one you just lowered, it might start to serve ads. Instead of lowering the CPC, you’ve just shifted traffic from one place to another. Not an ideal situation.

So here’s a script that will help you find situations where the same product is targeted by multiple product groups. It does this by looking for products that have received impressions from multiple product groups over the same date range.

Download the code to find duplicate product targets.

Avoid Traffic From ‘Everything Else’

Just like duplicate targets reduce our control over AdWords, so does traffic emanating from the product group of ‘everthing else’. To draw a parallel with keywords, it’s like buying the broadest keywords you can imagine and hoping for the best. Newbies continue to make this mistake but not PPC heroes like us, right? Well, it turns out that even the best of us probably fall victim to traffic spikes from ‘everything else’ and here’s why.

Avoid traffic from everything else
When product groups in AdWords get out of sync with products in the Merchant feed, traffic to ‘everything else’ may unexpectedly spike.

It’s useful to have a bid for the product group ‘everything else’ so that it can serve as a catch-all bucket for any products we didn’t include in a better-defined product group. The query data we get from this can help us optimize our campaigns.

But what if a retailer who sells t-shirts created product groups by brand and then later starts to sell a new brand of shirt. That new brand doesn’t fit the existing groups so it will automatically fall in the ‘everything else’ bucket. Unless we’re constantly checking that the feed is in sync with the AdWords product group structure (like we do with Optmyzr’s Shopping Campaign Refresher tool – that’s my company) or talking regularly with our clients to make sure they’re not changing the feed structure or changing their product mix, ‘everything else’ will at some point see traffic spikes.

I wrote a script that tells you the percentage of traffic coming from undefined product groupings like ‘everything else’. Run this script regularly and when the ratio gets too high, re-evaluate your product groupings to see if any new products need their own product groups.

Download the code to check your product group structure.

Manage Shopping Bids To A CPA Target

We should probably all manage ecommerce campaigns to ROAS targets (conversion value / cost) but a lot of clients still haven’t figured out how to pass the data about the value of the sale back to AdWords. It’s not technically challenging but inertia at companies of a certain size still makes this a difficult proposition. So I wrote a little script that uses CPA targets instead.

CPA bids for product groups
In just 14 lines of AdWords Scripts code, we can tell AdWords to set CPC bids for product groups based on conversion data.

The point of this script is really just to show how easy scripts can be. In 14 lines of code, I wrote a script that sets the CPC of a product group based on its historical conversion rate and a target CPA. If I didn’t care to make the code easy to read, I could have done it in 10 lines.

So grab this code and tweak it to work with ROAS, to send you alerts or do something else that makes it fit your needs. You’ll probably also want to build in some additional conditions for what to do when there are few or no conversions.

Download the code to set CPA based bids for product groups.

Download Shopping Reports

When it comes to bidding for Shopping ads, you may find that your own business data can tell you something about the likely conversion rates. In an example I received from the team at, they said that conversion rates are different for a shoe retailer who has all sizes in stock versus one that has a more limited number of sizes ready to ship. That makes perfect business sense and if you have an insight like that, you could add this sort of data in one of the five custom labels.

Download Shopping Ads Reports Automatically
Just a few lines of AdWords Scripts code can help you save custom AdWords reports to your Google Drive on a predefined schedule.

Then you can run the reports and calculate exactly how much difference there is in performance for the various labels. Here’s a simple script that downloads the shopping report and saves it to your Google Drive.

Download the code that saves a report to your Google Drive.


All these scripts are simple but they do things that we would otherwise have to do manually. By scheduling these to run periodically, we can offload repetitive work to the machines. You might think these are a decent starting point but wish they could do just a little more. And that’s the beauty of scripts. Copy my code, tweak it, and make it do exactly what you need.