Scripts are incredibly useful when it comes to getting the most out of Google Ads. These pieces of code are integral when it comes to looking beyond the manual features of Google Ads. They can give you an array of amazing insight and a wealth of information. Ultimately, it can be employed for impressive automated bidding.

In this article, we will demonstrate the value of an n-gram script.

What are n-grams?

N-grams models are used widely in communication theory, probability and computational linguistics. Google use them to correct your spelling mistakes and they are key to natural languge processing. Simply put, they are a way of understanding the relationship between words in a sequence.

An n-gram is a phrase made of n-words: a 1-gram is a single word, a 2-gram is a phrase made of two words, and so on. For example, “I Love Google Ads” contains three 2-grams (“I Love,” “Love Google,” “Google Ads”) and two 3-grams (“I Love Google” and “Love Google Ads”)

N-gram models are very relevant to the Google Ads platform. They can be used by biddable media specialists to better understand the performance of phrases within a PPC account.

Why are n-grams useful?

N-grams are useful because they allow you to identify certain words or phrases that are performing poorly, or conversely, keyword combinations that have yielded great results.

So, let’s say searches containing “free” perform poorly in general, but “free delivery” generates conversions.

The N-gram script adds up the clicks, impressions, cost, converted clicks and conversion value of each query containing the n-grams. It then calculates the click-through rate, cost per click, conversion rate, CPA and value/cost — so you can see their impact.

The script can be applied account-wide or localised to specific campaigns and ad groups. This can be extremely useful with regards to mining search terms for shopping campaigns or for new keywords in your search campaigns. It can also help with identifying negative keywords to help boost the return on ad spend (ROAS) of that specific campaign.

N-gram Script for Google Ads

Below is a link to the n-gram script with some simple instructions on how to use it:

At the top of the script, there are some options you will need to change depending on your preferences and account setup:

  • The startDate and endDate determine the date range of the data.
  • currencySymbol is your currency symbol, used for formatting.
  • campaignNameContains can be used to make the script only look at certain 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. This is not case-sensitive.
  • campaignNameDoesNotContain can be used to make the script ignore some campaigns. For example, if it’s set to “Competitor,” then the script would not look at any campaigns with “competitor” in their names. Again, this is not case-sensitive.
  • If ignorePausedCampaigns and ignorePausedAdGroups are both true, then the script will only look at currently active campaigns and ad groups. Set them to false if you want to look at data from currently paused campaigns/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 Doc spreadsheet, which the results will be copied into. Create a blank spreadsheet and put the URL in here. Do not ignore this step!
  • 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 overwritten. 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 & campaignNameDoesNotContain to look at different campaigns each time. Set clearSpreadsheet to false so you don’t overwrite the data from previous runs. (If you want the account-level data, you can copy all of the n-grams from campaign level into a new worksheet and then use a SUMIF function to find the totals.)

To use the script visit https://www.brainlabsdigital.com/search-query-n-gram-performance/

Brainlabs are industry leaders when it comes to PPC wisdom!

As well as being geniuses in the field, they are also super generous and share their vast array of other useful scripts with fellow PPC pundits.

Loom – Next Level PPC for Businesses

Got questions about the n-gram script and using it? Then contact Wez on [email protected].

If you are looking to take your Paid Media campaigns to the next level, and ensure you are getting the best ROI, then contact Loom.

Paid Media related

Insights

Tommy Pearson Growth Expert at Loom Digital

Tommy Pearson

Growth & Strategy