A Script For Identifying Ad Groups That Lack Sitelink Impressions

We all know by now that ad extensions in AdWords are an extremely effective way to boost our CTR. They’re easy to set up, don’t cost anything extra, and according to Google, sitelinks can boost the CTR of ads for non-brand searches by 10-20% and for branded search by up to 50%. Unfortunately, AdWords doesn’t make it very easy to determine which ad groups are not taking full advantage of this opportunity. So this month I am sharing an AdWords Script that generates a quick report to help identify opportunities with ad extensions.


ad group impressions with sitelink data
Get a report about what percentage of each ad group’s impressions also includes a sitelink extension.


Simple Scripts Can Be Written In 10 Minutes


The idea for this report came during my all-day training session on AdWords automation at ADworld Experience, an Italian PPC conference. I like to include live examples of writing AdWords Scripts to prove to the audience how easy it can be to come up with a quick solution. One member of the audience suggested I write a script to compare the total impressions for an ad with the number of impressions served with ad extensions. By taking the ratio, we can quickly find ads that have no extensions enabled or that are not serving extensions frequently.


Anyone interested in an upcoming full day training about AdWords automation and scripts should consider joining Anash Oommen, and Leo Sei from Google and me for our training day at Pubcon Las Vegas in October.


Outlining The Functionality Of The Script


With a little help from the audience, we had this script working in about 10 minutes. Here’s the rough flow of how the script works:


  1. The code pulls 2 separate AdWords reports: an extension report (for some reason Google calls this the Placeholder Report) and an ad text report.
  2. It must then join the 2 reports around a common element, in this case, the ID of the ad. To store the joined data, we can use an array and use the ad ID as the key. So for an ad with ID 1234, we store the data in an array variable, like map[1234].
  3. Each of these, in turn, is an object so now we get to store multiple pieces of information for each ad ID. When we’re pulling the extension report, we can store map[1234].impressionsWithExtensions and when we pull the ad text report we can store the data for map[1234].totalImpressions.
  4. Finally, we iterate through our entire map of ad IDs and we calculate the percentage of impressions with extensions.
  5. To make it easier to analyze the data we use the SpreadsheetApp service to store the data in a Google Spreadsheet.


Why We Used A Script To Generate This Report


This report can be useful because AdWords itself doesn’t let you merge the 2 reports needed to calculate the percentage of impressions with extensions. You could download the reports manually and merge them in Excel but that tends to be time-consuming and not great if you want to run the same report on a regular schedule.


Try The Script For Yourself


After the conference I cleaned up the code and decided to make 2 changes:


  1. The script will only check for sitelink impressions. This is extension type 1. You could easily update the script to look at all types of extensions. Simply find the ID of the type you want and update the code that gets the placeholder report.
  2. The script gets the data at the ad group level rather than the ad level by using the function runReportForAdGroups() instead of runReportForAds(). If you prefer getting the data at another level besides the ad group, simply update the function runReportForAdGroups() to pull the data you want and be sure to update the map with the ID of the common element, usually the ID of the entity you are reporting for.


Here is the script code. Simply copy-and-paste it in AdWords > Bulk Operations > Scripts.


After you run the code, look for a new Google Spreadsheet in your Google Drive with the data. As always, if you’d rather not deal with too much code, take a look at Enhanced Scripts™ for AdWords from Optmyzr and be sure to let us know if there’s a script you’d like to see us build next.




With a simple script like this, you can automate a tedious and repetitive reporting task that helps identify big opportunities in AdWords. Since I’ve written the code, you can literally automate this in one of your accounts in 30 seconds but with just 10 more minutes of your own time, you could tweak this script to do some variation of the same work based on your exact criteria. Happy AdWords Scripting!