How do ngrams help to improve keyword performance in Google Ads?
6 Min Read
A brief introduction to ngram analysis for Google Ads
Noticing trends and patterns in data are key aspects of optimising Google Ads performance, but large, complex data sets can make that part of account management challenging. This is especially true when it comes to analysing keywords and search queries in paid search, where there are often hundreds of thousands of long-tail keywords and search term permutations.However, many of the keyword level metrics in these large data sets are often too small and insignificant to draw any meaningful insights to act upon. Using a hotel in Cornwall as a hypothetical example; you might have a target CPA of £40 for a campaign, but thousands of search terms that have spent less than 50p - leaving the performance of these search terms largely meaningless.To get actionable and significant insights from a data set spread over many different keywords, you need to aggregate similar keywords. Aggregation allows you to maintain the signal and integrity of the underlying data while arriving at a more significant sample size on which to base your optimisation decisions.This is where ngram analysis comes in.
What is ngram analysis for Google Ads?
Ngram analysis is the process of splitting down search queries into individual ‘grams’. Let’s demonstrate this using the search query “Cornish spa hotel” as an example:
A 1 gram is a single word.i.e. there are 1 grams of: “Cornish”, “spa” and “hotel”
A 2 gram is a phrase made of two words. i.e. in this example, there are 2 grams of: “Cornish Spa” and “Spa Hotel”
Finally, this query also has a 3 gram. i.e. the complete phrase “Cornish spa hotel”
Here, we have used a single search query [“Cornish spa hotel”] to demonstrate the use case.In ngram analysis, individual grams are pulled from every single query that contains those grams. For example, the word “spa” might be in a thousands of queries:
"Cornish spa hotel"
"Cornish spa hotel in Falmouth"
"Cornish spa hotel with restaurant"
"Is it acceptable to bring your own pasty to spa hotels?"
"Hotels near Bath Spa University"
Ngram analysis allows you to review the metrics for each of those grams to identify performance patterns, which will give you ideas for positive and negative keywords.For example, you might see that the word “spa” turns out to be high spend, low ROAS.
How do you pull and interpret ngram data from Google Ads?
With a Google Ads script, of course! Scripts are snippets of JavaScript code that you can deploy in your account to help you automate repetitive tasks to free up your time to focus on the important task of better optimising the performance of the account. Below, we have provided you with a link to a ngram analysis for Google Ads script that will help aggregate and automate your ngram analysis.This particular script adds up the clicks, impressions, converted clicks, cost and conversion value of each query containing the ngrams.It calculates the click-through rate, cost per click, conversion rate, CPA and value/cost — so you can understand the true impact at ad group, campaign and account level.If the performance is good, you may decide to make new ad groups around an ngram; if the performance is bad, you might want to exclude the ngram as a negative phrase match keyword.Finally, there is also a word count analysis to tell you if longer or shorter queries work best in your account.
How to use an ngram analysis script in Google Ads?
At the top of the script, there are some options you will need to change depending on your preferences and account structure:
The StartDate and EndDate refers to the date range of the data.
CampaignNameContains can be used to make the script only look at some campaigns. For example, if it’s set to “High Priority,” the script will only look at search queries in campaigns with “high priority” in the name. It is now not case sensitive.
CampaignNameDoesNotContain can be used to make the script ignore some campaigns. For example, if it is set to “Competitor,” then the script would not look at any campaigns with “competitor” in their names.
If IgnorePausedCampaigns and IgnorePausedAdGroups are both true, then the script will only look at currently active campaigns and ad groups.
If CheckNegatives is true, then the script will check queries against the current negative keywords, so any queries that would now be excluded are ignored. If this is set to false, then all queries will be used. If you have a lot of negatives, and the script keeps timing out, try setting this to false.
SpreadSheetURL is the URL of a Google Sheets spreadsheet, which the results will be copied into. Create a blank spreadsheet and put the URL in here. This step is vital in order for the script to function!
MinNGramLength and MaxNGramLength let you say how big or small the phrases you are looking at should be. For example, if you set MinNGramLength to 2 and MaxNGramLength to 4, it will look at 2-grams, 3-grams and 4-grams. If you set both MinNGramLength and MaxNGramLength to 2, it will only look at two word phrases. Set both to 1 to look at only single words.
If ClearSpreadsheet is true, any data already in the spreadsheet will be over-written. If it’s false, then the script’s results will be added at the end of the sheets.
If you find the script keeps timing out, it may be that your account is too big. Try running the script multiple times using CampaignNameContains and CampaignNameDoesNotContain to look at different campaigns each time. Set clearSpreadsheet to false so you don’t over-write the data from previous runs.If you want the account level data, you can copy all of the ngrams from campaign level into a new worksheet and then use a SUMIF function to find the totals.Happy scripting!