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

Boost Your Website's User Experience with Live Chat Integration

Boost Your Website’s User Experience with Live Chat Integration

Are you interested in finding ways to enhance the user experience of your website? Are you interested in finding ways to enhance the user experience of your website? The implementation of live chat capabilities on websites is an excellent method for enhancing the user experience and providing better customer support. Implementing chat widgets can greatly enhance customer engagement, improve conversion rates, and strengthen your online reputation. Let’s explore the benefits of incorporating live chat into your website.

Optimize Your Website Speed for Maximum Conversion

Optimize Your Website Speed for Maximum Conversion

Your website plays a crucial role in shaping a consumer’s first impression of your company. Ensuring that your website loads quickly and is optimized is crucial, as it can make or break a potential conversion. Prior to implementing any modifications that may affect the loading speed and content management of your website, it is recommended to conduct a thorough evaluation of its current performance.

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