How to Use N-Gram Analysis of Search Console Queries to Optimise Content & Internal Links

N-gram analysis is a powerful tool that can be used to optimise your webpage content and internal links. By analysing the frequency of specific word combinations (n-grams) in your search console queries, you can gain valuable insights into the search intent of your audience and use this information to improve your website’s content and internal linking strategy. Follow these steps in this how-to guide, you will learn how to do an N-Gram analysis of search console query data.

How to Use Google Search Console to Optimize Internal Links

Step 1: Access Your Google Search Console Query Data

search analytics for sheets add-on

To begin, you will need to access your Google Search Console query data. To do this, log in to your Google Search Console account and navigate to the Performance section. From there, select the Pages tab and choose the page you want to optimise. While the Google Search Console UI allows you to view your query data, it is limited to only 1000 queries per page. To access a larger set of query data, you can use the Search Analytics for Sheets add-on. This Google Sheets add-on enables you to access an unlimited quantity of queries (with a cap of 25,000 queries on the complimentary plan) for a particular URL or webpage that includes a specific string within its URL.

To access your query data using the Search Analytics for Sheets extension, follow the below steps;

search analytics for sheets add-on steps to request query data
  1. First, install the Search Analytics for Sheets add-on on your Google Sheets account.
  2. Once installed, open a new sheet and select “Add-ons” from the menu. Then, click on “Search Analytics for Sheets” and select “Open Sidebar”.
  3. In the sidebar, select the website you want to analyse. You can select the date range and use a filter to select either a particular URL or webpage that includes a specific string within its URL.
  4. After making your selections, click on “Request Data” to download the query data.

Step 2: Prepare Your Query Data for N-gram Analysis

After downloading your query data with the previous step, you can directly process it on the sheet, initiating the cleaning and preparation for analysis.

Begin by eliminating unnecessary columns from your analysis. For instance, consider removing columns like CTR and position if your focus is solely on analysing query data. Be sure to rename your Queries and Impressions columns to “query” and “impressions,” as the upcoming Python script will anticipate these header names.

Once the data is clean and formatted, consider sorting the queries by impressions in descending order to prioritise the most significant ones.

Step 3: Prepare your Input.csv file

After cleaning and preparing your query data in the above step, you may want to save it as a CSV file (Comma Delimited). To save your cleaned query data as a CSV file, go to the “File” menu in Google Sheets and select “Download”. From the dropdown menu, select “Comma-separated values (.csv, current sheet)”.

Your cleaned query data will now be saved as a CSV file on your computer. Rename the file as input.csv. This input.csv file will be used for n-gram analysis with a Python script in the subsequent step.

Sample Input CSV File

sample python script input.csv file

Step 4: Execute the Python Script

With your data cleaned and prepared, you can now perform an n-gram analysis. N-gram analysis involves analysing the frequency of specific word combinations (n-grams) in your query data. The most common n-grams will give you an idea of what people are searching for when they visit your webpage.

To perform an n-gram analysis on your query data, you can use the following Python script. The script requires the following libraries. Run the following command on your Windows / MAC.

For Windows Users

Command: pip install requests beautifulsoup4 nltk

For Mac Users

Command: pip3 install requests beautifulsoup4 nltk

Execute the Script

Open the command prompt (on your PC) or terminal (if using a Mac) and navigate to the Python folder. My script expects the input.csv to be in the same folder as the Python executable. Once you are in the right folder, you can execute the script using the below command.

For Windows Users

Command: python

For Mac Users

Command: python3

Please note that you will need to modify the script to match your file paths of your input.csv file.

python ngrams execute script

Step 5: Use N-Gram Analysis to Optimize Your Content and Internal Links

Once you execute the script, the resulting output.csv file will contain the most common n-grams and their corresponding impression volume, which you can use to optimise your content and internal linking strategy.

Use the most frequently used n-grams to identify audience interests for content creation and optimisation. Additionally, use n-grams to improve internal linking and enhance search engine crawling and indexing of your website.

Sample Output CSV File

sample output.csv file

Step 6: Monitor and Adjust

Finally, it is important to monitor and adjust your content and internal linking strategy over time. By regularly analysing your Google Search Console query data and making adjustments based on the insights gained from n-gram analysis, you can continuously improve your SEO performance.

0 comments… add one

Leave a Reply

Your email address will not be published. Required fields are marked *