WolfGang Logo
Wolfgang Digital Blog Banner Images

By Peter Scott on 26 Sep 2017

ngrams adwords script

We’ve been on a bit of a buzz lately where we focus in on you not wasting your Google Ads budget. Your advertising budget is a valuable commodity and every cent you can save on poorly performing areas of your Google Ad account goes towards areas that are converting and making you money. Previously, we showed you some great techniques you can apply to your Google Ad account to help you reduce your wasted ad spend. In this article, we’re going to show you a third party piece of code that we use to weed out high cost and low-performing keywords during our keyword optimisations.

Meet Your New Best Friend: N-Grams

An n-gram is a phrase consisting of a number of words, a number we call “n”. For example, a 1-gram is a single word, a 2-gram is a phrase consisting of two words and so on. 

Here's an example of n-grams in action: “performance agency wolfgang digital” contains three 2 n-grams (performance agency, wolfgang digital, and agency wolfgang) and three 2 n-grams (performance agency wolfgang, agency wolfgang digital).

Google Ad Scripts and the N-Gram Script

With a Google Ads script, you can automate manual tasks in Google Ads, including the creation of some really interesting reports. A great example was created by Daniel Gilbert and our friends over in Brainlabs called the n-gram script. This script looks at the aggregate performances of individual words or phrases within larger queries.

For example, if you’re selling smartphones, you’ll be able to see the performance of search queries by colour. Here’s how the search queries might look for a smartphone retailer:


smartphone queries

After running the n-gram script, the smartphone retailer will then be able to see how individual words are performing:

smartphone queries n-gram

This is a great way of uncovering keywords which signal your customers’ intent.

Benefits of Using the N-Gram Script

When managing smaller accounts, keyword optimisation usually isn’t a problem. Instead, the problems come as an Google Ad account grows and matures, gathering large volumes of keywords and even larger volumes of search queries. n-grams are a smart solution to this ‘big data problem’.

Let’s flip that ‘problem’ on its head for a minute. As your Google Ad account grows along with the volumes of data you have, so too does the amount of data you can learn from. It’s critical that the dataset you’re working with is clean and accurate, but with those boxes ticked, Gilbert’s n-grams script turns this dark cavern of metrics into actionable data.

We began by running the n-gram report on a small scale and were rewarded with impressive results. With a small scale test complete, we decided to ramp it up, applying the script to a mature account with huge volumes of data, running the report over a two-year period.

Keyword optimisation is a foundational element of any AdWords account. The goal with keyword optimisation is to remove underperforming keywords which are draining your budget. In return, you have more budget to allocate towards high-performing and low-cost keywords. 

What We Learned From N-Grams

Keywords that make sense, don’t always make sense

When carrying out Google Ads keyword optimisations, there’s an easy trap to fall into where you see a phrase within a campaign and without the statistically significant data to optimise it, you believe it’s a perfect fit. The phrase might actually fit so well that it feels counter-intuitive to remove it. The n-grams script makes interpreting keywords and phrase performance much clearer by bundling groups of words that appear in multiple search queries together. This provides a foundation of statistically significant data for you to build your optimisations on.

Take our smartphone example from above. You might think that “smartphone on sale” is a great term to include. However, when we let the data speak for itself from this example, it’s clear that this is a non-converting term, costing valuable ad spend budget which could be spent elsewhere.

These are the learnings offered by n-grams.

Better Performance = Using the Data

By applying this data-driven n-gram scripted approach to keyword optimisation, our non-brand campaigns experienced a huge performance boost. Conversion Rate climbed to 60% above a two-year average. This data-driven approach to optimisation also brought a record two-year low Cost per Conversion, 44% below the account’s two-year average.

You’ll Spot Keywords of Intent

As a result of using huge volumes of data like this, you as a digital marketer will grow. You’ll begin to see patterns in the terms and queries that convert well. These patterns will be around user intent and the language people use prior to a conversion. Over time, you’ll learn which words to include and exclude when you initially build out a campaign.

The Wolfgang Essential Takeaway

N-grams reporting might present a bit of a learning curve, but the return on that learning is huge. This n-gram script is completely free and lets you turn a deluge of big data into actionable bite-sized chunks. From there, you can identify low-performance keywords, shifting your budget towards high-performance power terms and jump aboard our buzz of reducing wasted ad spend.

As a result, your spend will move from high cost and lower performing terms, towards low-cost, high-performance terms.

Try Out This N-Grams Script For Yourself

To use this script yourself, just copy and paste into your account, changing some of the variables at the start to suit your needs. Daniel has some more instructions over here.

Share This Article

Contact Wolfgang Digital


Palmerston House, Denzille Lane Dublin 2


Weesperstraat 61-105 Amsterdam Kantoor 230

Bing Partner
Wolfgang Digital

Want To Talk Digital Marketing?

Let's Get Started!