Keyword Clustering and Grouping

Need better organic traffic? Find the most important keyword topics with cluster analysis.

Both for SEO and PPC managers, keyword grouping and clustering is a very powerful technique for keyword research. Keyword grouping will help you see the whole picture and drive organic traffic to your website.


You want to explore a new keyword set

Let’s say someone is sending you a file with 500.000 keywords and wants to talk with you about a SEO content strategy. For understanding the status quo clustering techniques are great for getting a good understanding how the main search patterns are looking like. In addition to that N-Gram analysis of your keywords are also a great starting point.

You want to get keyword topics in short time

Grouping your keywords with cluster algorithms will give you the main ideas of keywords topics. When you put these keyword clusters in hierarchical order you are able to build a SEO content strategy with big main topics and linked sub topics. Compared to other keyword research approaches like the powerful keyword tagging the main benefit is low effort and quick results.


1) Keyword Preprocessing

First you should bring your keywords to lowercase and remove special characters with some RegEx operations. Split your full keyword into single words and use stemming functions like Porter Stemmer or Snowball Stemmer. This will reduce every word to their root form and makes in possible to group similar words together.

3) Choose a cluster algorithm

You can choose between a lot of different clustering algorithms. The most popular approach is k-means clustering. “k” stands for the number of clusters that should be created. Sometimes estimating the number of clusters can be difficult. To avoid this you can use approaches like DBSCAN – of course you can also tweak some parameters here.

2) Transform your keywords to vector space

Cluster algorithms run on numeric data. For that reason we have to transform all keywords into a vector space. Scikit has modules that will do most of the job. I recommend to use TfidfVectorizer for the feature extraction from your keywords. It is using Tf-Idf numbers as weightings for each word within your vector.

4) Export Keyword Groups in an actionable way

In the end it is all about using the results of the cluster analysis for actions. For some use cases exporting the full keywords to a CSV file is fine. Put the cluster name in one column and concatenate all assigned keywords with a delimiter together and show them in the second column. If you like visualizations better you can create one word cloud per cluster and arrange show them next to each other.


Autosuggest Keyword Source

You probably think of Google Autosuggest first. But this is just one possible source you can use. Also look at YouTube and big autocomplete sources. You can be sure that only relevant search suggestions will be shown here – otherwise the user experience would be bad within the search engine. I’m always wondering why a lot of those queries never appear when you just look at the search volume of a keyword. Time to think about that!

Your PPC Queries as Keyword Source

This is a great source if you use the existing queries within your Google Ads account. Especially for SEO people it is difficult to quantify a keyword based on business value. By using conversion metrics in paid search we can to this. You will realize that the focus on search volume is not the best way. There will be a lot of longtail keywords that are hidden champions when it comes to a transaction based perspective. Optimize for these keywords to increase the value of your traffic!

Keyword Planner

The google keyword planner is another good resource for getting new keywords. It is part of your google ads account and should help you to find new keywords to spend money on. Of course you can also use them for your SEO projects. A nice recent add-on was the “refine” keywords option. Google is clustering the suggested keywords by entities they are recognized. Of course in a very generic way that fits to all business out there.

Google Trends

Google Trends is another great source for free keyword ideas. There is no official API available but with the Python module Pytrends you can query google trends in an automated way. It gives you the opportunity to identify trending search queries for your business. By knowing these trends you can be the first person out there who is providing the perfect content page to match to those queries. The competition is probably lower and it is easier to get some organic rankings.