Python Keyword Counter Tool

The Python Keyword Counter Tool is a powerful yet simple tool that allows you to improve your website's visibility and search engine rankings. By comparing search phrases from Google Search Console with a list of URLs, you can identify which pages on your website are performing well in search results for a certain phrase but don’t have the exact match phrase present on the targeted page.

This information can then be used to make informed decisions about which keywords and phrases to optimize for in order to improve your search engine rankings.

To use the Python Keyword Counter Tool, you will need to have a basic understanding of Python programming and a list of URLs that you want to check. You will also need to have access to Google Search Console for the website you want to check and optimize. Once you have this information, you can enter phrases and URLs into the tool and run the code.

The code uses the requests library to send GET requests to a list of URLs, which are then searched for a set of phrases. The number of occurrences of each phrase on each page is stored in a dictionary and then used to create a Pandas dataframe. The dataframe is returned as the result of the function. The code also includes a HEADERS variable which sets a user agent for the GET requests.

It also includes a feature to export the results to a CSV file. This allows the user to easily analyze and manipulate the data in a spreadsheet program such as Microsoft Excel or Google Sheets. This feature is especially useful for SEO professionals who are looking to track the performance of their keywords on a specific set of pages. With this tool, they can quickly compare the occurrences of their target keywords on different pages, identify any discrepancies and make necessary adjustments to their content strategy. Overall, this Python Keyword Counter Tool provides an efficient and streamlined way for SEO professionals to track and analyze the performance of their keywords on a set of URLs.

Here is an example of the code that checks three URLs and five keywords:

				
					import requests
import pandas as pd

HEADERS = {'User-Agent': 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148'}

def check_phrases(url, phrases):
page = requests.get(url, headers=HEADERS)
page_content = page.text
phrase_count = {}
for phrase in phrases:
phrase_count[phrase.lower()] = page_content.lower().count(phrase.lower())
df = pd.DataFrame.from_dict(phrase_count,orient='index',columns=[url])
return df

 

urls = [

    'https://policies.google.com/privacy',

    'https://policies.google.com/terms',

    'https://policies.google.com/technologies'

]

phrases = [

    'google',

    'privacy',

    'services',

    'terms',

    'data'

 

]

results = pd.concat([check_phrases(url,phrases) for url in urls], axis=1)
results.to_csv('phrases_counts.csv')
				
			

 

The CSV output for this code in our example where we used the code to check three URLs and the presence of five keywords on them should look like this:

 

Python Keyword Counter Tool CSV Example

 

 

How to run Python Keyword Counter Tool

To run this tool, you will need to have Python and the necessary libraries (requests and pandas) installed on your computer.

  • First, you will need to input your list of URLs and the set of phrases that you want to search for into the code. This can typically be done by editing the variables at the beginning of the script.
  • Once you have the URLs and phrases inputted, you can run the script by opening up a command prompt or terminal, navigating to the directory where the script is saved, and running the command “python scriptname.py” (replacing “scriptname.py” with the actual name of your script).
  • The script will then execute, sending GET requests to each of the URLs and searching for the specified phrases. The results will be stored in a dictionary and then used to create a Pandas dataframe.
  • The dataframe will be exported as a csv file in the working directory with the name “phrases_counts.csv”
  • You can then open the csv file in a spreadsheet software to visualize the results and analyze the data.

 

Python Keyword Counter Tool Use Cases

There are many different use cases for the Python Keyword Counter Tool in SEO. For example, you can use the tool to:

  • Identify which pages on your website are performing well in search results and which pages are not. This information can then be used to make informed decisions about which keywords and phrases to optimize for in order to improve your search engine rankings.
  • Analyze the impact of changes made to your website on search engine visibility. By comparing the results of the tool before and after making changes to your website, you can see how those changes affected your search engine rankings.
  • Identify which keywords and phrases to optimize for in order to improve your search engine rankings. By analyzing the results of the tool, you can identify which keywords and phrases are most frequently appearing on your website and which keywords and phrases are not.
 

To get the most out of the Python Keyword Counter Tool, it is important to use it regularly with phrases from Google Search Console and to keep track of the results over time. This will allow you to see how your website’s visibility and search engine rankings are changing with the improvements you are making.

 

Don’t Stop Here

More To Explore

The Power of Wikipedia Backlinks for Improved Rankings

The Power of Wikipedia Backlinks for Improved Rankings

Within the complex field of Search Engine Optimization (SEO), backlinks are regarded as website endorsements that inform search engines about the relevancy and caliber of the content. Among the many platforms available for obtaining backlinks, Wikipedia stands out as the most reliable source due to its strong domain authority and high trust ratio.

How NLP-Based SEO is Reshaping Digital Marketing Strategies

How NLP Improves Search Engine Rankings

Enhancing a website’s visibility and traffic from search engines involves the intricate process known as Search Engine Optimization. As search engine algorithms evolve, businesses must continually refine their approaches to stay visible and relevant in the online landscape. A rising trend in this field is NLP-based SEO. But what exactly does this entail, and how does it influence search engine rankings?

Python Keyword Counter Tool

Let's Talk Marketing

small_c_popup-1.png

Contact Us

Fill out the form below, and we'll be in touch shortly.

©2022 Benlola Marketing Services