How to create a keyword ranking tracker SEO tool
Tags: seo, buildinpublic
Published: 2023-10-09 22:35:03

Ahrefs, ubersuggest, semrush as well as other professional SEO tools offer this one feature: Ranking tracker.

> Disclaimer: this article contains the overview or pseudo code how you can build your own tool, not the actual code itself.

## What is a ranking tracker in SEO ?
A ranking tracker in SEO is a tool that allows you to track and monitor the positions of your website's keywords in search engine results pages (SERPs).

## What is the benefit of tracking ranking ?
SEO ranking trackers help you to understand how well your SEO strategies are working by showing where your site ranks for specific keywords. 

It's hard to determine, if the SEO strategy you've implemented, working correctly or not without track the real result.

In general, this can be critical for your business because the higher your website ranks on search engines like Google, the more visible it is to potential visitors or customers.

## What are we going to build ?
Specifically, we will build a **keyword ranking tracker tool**.

> Keyword Ranking: The tool tracks where your website ranks on search engines for each keyword. It shows whether your site's ranking has gone up or down over a period of time.

For simpliciy sake, we'll focus on Google, but you can apply the same ideas to other search engine as well.

## How to build a keyword ranking tracker SEO tool

Here is the step by step

### 1. Understand what are we going to build
Here's how it a keyword ranking tracker normally looks like
![build keyword ranking tracker tool](https://i.ibb.co/ZhM14sT/sample-a-keyword-ranking-tracker-tool.webp)

Each keyword shows the rank result between dates. For better UX, we can add visual of how is the ranking perform and by how many (green/red).

### 2. User add domain, keyword and location
- User must add their domain name
- User must add their keyword and search location (where do you want the keyword to rank)

**Locations search is important, since different location/language can show different search results.**

### 3. Scrape google result with the keyword you want.
This API will take the keyword user add on frontend, and perform a scrape based on this keyword, remember to adjust the location search.

> We only scrape the search results! not each of the url

While scraping, we count each of the position (as simple as position++),
until we found the first encountered result with user's domain. 

Once we found it, we can stop the scraping and save the position to database + with the date.

Tips: You can give a limit to 100. If it's more than 100 search and not found, we can just add 100+.

### 4. Run it automatically with cron
Since ranking is keep moving, we can't just do this for one time. To automate this, you can add a CRON ,that doing the step #3. 

Remember to save the position and date in position.

## Optional tips

### Using official Google Search API
Without scraping, we can use [Google official search API](https://developers.google.com/custom-search/v1/overview)

### Using 3rd party SERP API
There are many services that offer SERP API like our case, you can use this 3rd part API like:

- [serpAPI](https://serpapi.com)
- [DataForSEO](https://dataforseo.com/)
- [BrightData](https://brightdata.com/products/serp-api)

### Using GSC API
Google search console API has an official API to track your queries
[Google webmaster API](https://developers.google.com/webmaster-tools/v1/how-tos/search_analytics).

Which requires the site you want to track to be at GSC first, and connect it via API later.



## More functionality we can explore in ranking tracker
Here are some ideas what more you can add to this ranking tracker tool:

Here are some of the functionalities of a typical SEO ranking tracker:

### Competitor Tracking
Many SEO ranking trackers allow you to monitor your competitors' keyword rankings. This gives you valuable insights into their SEO strategies and helps you identify opportunities to improve your own.

### Localization
SEO ranking trackers often allow you to check your keyword rankings based on location. This is useful for businesses targeting specific geographic markets.

### Device Type
Some tools let you filter keyword rankings by device type, such as desktop or mobile. This helps you understand how your website performs across different devices.

### Reporting
Most SEO ranking trackers generate reports that provide a clear and concise overview of your keyword performance.

### Historical Data
They often provide historical data so you can see how your rankings have changed over time.

### Alerts
Some trackers offer alerts when significant changes occur in your keyword rankings.


That's it! feel free to explore