Analyzing close variant matches in Google Ads with Python

We have lost exact match keyword and “not significant” queries with the updates in Google Ads. However, we can still measure the effects with a smart Python solution. Here’s how.

The exact match keyword is gone. It’s more difficult to track the effects with the recent roll-out of hiding “not significant” queries in your Google Ads search term report. No more posts about this topic anymore. The doors are wide open for Google to tweak the matching logic.

Let’s have a look at our Python solution to analyze what is happening exactly.

The Setup: How to measure changes in Google’s matching

The idea for analyzing the matching logic:
How similar is the triggered search query compared to the exact keyword? For the similarity we used a Levenshtein distance metric. It is used within the Python module FuzzyWuzzy.

This is how it looks like:

import pandas as pd
from fuzzywuzzy import fuzz


def getScoreSort(query,keyword):
    # fuzz.token_sort_ratio means that the order of words does not matter
    # "hotel berlin" == "berlin hotel" 
    return fuzz.token_sort_ratio(keyword, query)

def getScoreRatio(query,keyword):
    # fuzz.ratio means the order of words matters
    # This is the strictest way of comparing strings - it will give you lower scores
    return fuzz.ratio(keyword, query)

df = pd.read_csv("querydata.csv",delimiter=";")
df['ScoreRatio'] = df.apply(lambda row: getScoreRatio(row['Query'],row["KeywordTextMatchingQuery"]),axis=1)
df['ScoreSort'] = df.apply(lambda row: getScoreSort(row['Query'],row["KeywordTextMatchingQuery"]),axis=1)


Now you have everything you need to run some further analysis in your pandas dataframe. If you want to use a free online tool for running those analysis please have a look here.

More Similar Posts

Menu