Friday, December 27, 2024
spot_img

Top 5 This Week

Related Posts

Word association: Here’s a script for analyzing the phrases that associate with your terms

Word Cloud Association Ss 1920

This was a hard one to name, but trust me, it’s a good one.

The idea came from an account my employer was running for a financial client. We wanted to know what the most popular queries were for a particular competitor, and after some laborious manual analysis, we discovered that “complaints” was the most common associated word. Imagine how useful that little piece of info turned out to be, in terms of altering ad copy and adapting our keyword coverage.

Now imagine instead of spending hours and hours trawling through the masses of data any one account might accrue, you had a nifty piece of code to do it all for you. Imagine no longer: Please welcome “Associated Search Analysis.”

(If anyone can think of a better name, hit me up).

The script automatically analyzes account data to produce a report of all the phrases that are associated with your chosen terms. So, let’s say you choose “suitcase,” the report will show you all the fun ways people end up searching for that term, including all your favorite AdWords metrics.

For example, maybe the highest impression share will come from color adjectives like “black” and “vermilion” and so on. Or maybe it will be “lifetime warranty,” which some luggage companies offer. The results may lead to an entire change of strategy, or at the very least some valuable ideas for adjusting ad copy. This is also a good report to pass on to a client, so they can mine it for insights to apply to their offline marketing. There are many possibilities.

To use the script, you need to make a blank Google spreadsheet (for the report) and make a note of its URL. Then copy the code below into your account, and change a few options at the top:

  • startDate and endDate determine the date range of the data. Enter them in yyyy-mm-dd format.
  • currencySymbol is used when formatting cost data in the report.
  • campaignNameContains and campaignNameDoesNotContain filter which campaigns the script gets data from. For example, if campaignNameContains is [“Brand”, “Generic”] then only campaigns with names containing “brand” or “generic” are included. If campaignNameDoesNotContain is [“Display”, “Competitor”] then any campaigns with names containing “display” or “competitor” are ignored.
    • This is not case-sensitive.
    • Leave blank, [], to include all campaigns.
    • If you need to put a double quote into campaignNameContains or campaignNameDoesNotContain, put a backslash before it.
  • ignorePausedCampaigns should be set to true if you only want to look at currently active campaigns, or false if you want to include them.
  • Similarly ignorePausedAdGroups should be true to only look at currently active ad groups, and false to include paused ones.
  • reportAdGroupLevel should be true if you want to report on phrases used in individual ad groups. If this is false, ad group level will not be reported.
    • Campaign and account level data is always reported.
  • spreadsheetUrl is the URL of a Google Doc spreadsheet, which the results will be written into. Create a blank spreadsheet and put the URL in here.
  • textOfInterest is the list of competitor names, products, synonyms, or whatever else you’re interested in. The script will see what words and phrases also appear in searches that contain these pieces of text.
    • These should be in double quotes and separated by commas, e.g. [“one”, “two”, “three”]
    • This text will be compared against search queries. Don’t use punctuation that won’t appear in the search query report.
    • Note that the script will only look at searches if the text appears in it as a whole phrase. For example, if your text of interest is [“go east”] it will look at searches like “go east now” but not “go easter eggs.”
  • minNGramLength and maxNGramLength let you say what size of phrase to look for. For example, if you set minNGramLength to 2 and maxNGramLength to 4, the report will give the two word, three-word and four-word phrases that appear in search queries which also contain your chosen text.
    • 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.

There are also some advanced options: Thresholds for the different statistics are given, so you can stop the report showing performance for phrases with very few searches.

If the script can’t write to the Google Sheet because it runs out of space, try using the thresholds to remove the less important phrases, or use reportAdGroupLevel to only report at campaign and account level.

If you’re having trouble with the script timing out, try running the script multiple times, using campaignNameContains or campaignNameDoesNotContain to look at different campaigns for each run. If you’re looking for phrases of different sizes, you could do separate runs for each size.


Contributing authors are invited to create content for Search Engine Land and are chosen for their expertise and contribution to the search community. Our contributors work under the oversight of the editorial staff and contributions are checked for quality and relevance to our readers. The opinions they express are their own.


Popular Articles