Jan 26, 2017
0 0

How to split test in AdWords more effectively using Adwords Scripts

Written by

Google AdWords scripts are an incredibly powerful tool for managing Google AdWords campaigns and automating laborious tasks.

AdWords scripts were voted the 3rd most useful Adwords optimization tool by a panel of 41 seasoned AdWords experts.

One of those tasks is A/B testing, where it can be incredibly difficult to keep track of when all of your tests have finished in large-scale Adwords accounts. However, split testing is essential for increasing your CTR, Quality Score and conversion rates.

In this article, I’m going to be explaining how you can use AdWords scripts to monitor and report the progress of your A/B tests, so you won’t have to trawl through your data to see when your tests have finished.

I’m also going to be showing you how you can use scripts that aggregate data, so you can reach statistically significant decisions on ads faster, where individually there would not be enough data. Furthermore, I’ll explain how to avoid “Simpson's paradox” that can skew your results when you're aggregating data.

Adwords scripts for monitoring your tests

If you have thousands of adverts within your account it can be very difficult to keep track of the progress of your tests. This is an area that scripts can come in very useful.

Russel Savage has created this free script that monitors all of your split tests, to see when they have hit statistical significance, and then emails you when the test is done, so that you can take action.

The script keeps track of when you make changes and knows when a new test has started, without you having to keep track. It also applies labels to adverts so that you can see within your account, what stage your tests are at.

labels in google scripts

Here is an example of the labels that the scripts apply to adverts. If the test has finished it will apply the labels “loser 95% confidence” to the advert that has lost, and labels the best performing ad “current champion”.

To use this script there are three steps that you need to follow. Firstly copy and paste the script into Adwords. If your unsure on how to do this follow these instructions here (LINK _WWWL).

The second step is to tell the script which email address that you want the emails to be sent to, to tell you that your tests have finished.

On line 20 of the script replace [email protected]=” with the email address that you want the emails sent to, telling you when your test has finished too.

The third step is to choose a confidence level on line 21, by default it is set to 95% which means that when you make a decision, you will be correct 19 out of 20 times. If you wish you can increase this to 99% so you will be correct 99 out of 100 times but this will require more data.

The fourth step is to choose what you would like to compare. At the moment the script is set to CTR, so the winner will be the advert with the highest CTR.

Howeve,r you may want to test for different metrics depending on what you are trying to achieve. For example, if you want to reduce the cost per conversion in an account, you may want to change the metric to cost per conversion, or if you're trying to increase the conversion rate, you might want to set it to compare conversion rates.

To do this you need to make two very simple changes to the codes on line 33 and 34.

To compare cost per conversions, use the following:

var VISITORS_METRIC = 'Conversions';


To compare conversion rate use the following:

var VISITORS_METRIC = 'Clicks';

var CONVERSIONS_METRIC = 'Conversions';

Finally, if you want to include links to the campaigns and ad groups that you are testing in the email, you need to fill out lines 60 and 61 of the script.

To do this log into Adwords and copy the URL of the page, it should look something like this.


U and C are 10 didgit codes that are unique to each account. What you need to do is copy these into lines 60 ad 61 of the script, so it should look something like this.

var __c = '9807638908';

var __u = '6598756484';

Once you have done this you should be set and ready to go.

Aggregating data using Adwords scripts to test faster

When split testing adverts in ad groups that only have a small search volume it can be difficult to get enough data to make statistically significant decisions.

You must, however, be careful when aggregating data to avoid “Simpsons Paradox

Simpson's paradox is “a paradox in which a trend that appears in different groups of data disappears when these groups are combined, and the reverse trend appears for the aggregate data.”


Ad group 1 data

ad group dataAd group 2 data

ad group data

Aggregate data aggregate data

Advert 1 is the best performing ad group in both ad group 1 and ad group 2, however when the data is aggregated, it appears that advert 2 was the best performing, giving an incorrect result.

There are, however, two simple measure that you can take to ensure that you don’t fall into Simpsons paradox.

You need to ensure that your ads are served evenly, so both ads will have a similar number of impressions. To do this use the “rotate ads indefinitely” which can be found in your campaign settings.

google adwords rotate indefinitely

If your ads are distributed evenly across ad groups, and your ad groups are closely themed, there’s no risk of falling into the Simpson’s Paradox trap.

My favorite scripts for aggregating data for split testing come from Fredrick Valaeys from optmyzr. The script produces a report of the various elements of your text ads.

The script aggregates data from all of the commonly used headlines, display URL’s and description lines within your account.

ad template performance

This script is ideal for aggregating data from similar ads across an entire account so you can make statistically significant decisions faster. Its also fantastic for finding the best performing text elements so you can theoretical create the perfect Adwords ads.

The only downside to this script is that its not freely available and is only purchasable through a subscription to Optmyzr.


As I hope you can see, AdWords Scripts are an incredibly useful tool for making A/B testing easier on large scale PPC Accounts, or where you have a large number of ad groups with very few impressions.

With the growing number of pre written Adwords scripts available, they are no longer just for experienced coders, any Adwords user can use them. So if there is anything you take from today, it should be that you should start utilizing scripts to make tasks such as split testing more efficient and less laborious.

Read on: SmartInsights

Article Categories:

Leave a Comment