Sign in Sign Up

We use cookies to make Serpstat better. By clicking "Accept cookies", you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Learn more

Report a bug

5902 3
Content Marketing 5 min read
Dmitriy Mazuryan
Keyword suggestion script for content writers based on Google Keyword Suggestions and API Serpstat

How to choose effective keywords? Keyword suggestion script
SEO expert at Netpeak Group
In this article SEO expert at Netpeak Group, Dmitriy Mazuryan, shares his script and tells how it works. This script aims to help content writers save their time spent on collecting relevant keywords.

How does it work?

The script's algorithm is based on:

  • Google Keyword Suggestions

  • API Serpstat (you can find your API token at your profile)
Here is how it works:

  1. Script collects the keywords from Serpstat's database

  2. Then it collects search suggestions from Serpstat's database

  3. Finally, it collects search suggestions from Google's suggestions

You give "weight" to these keywords to get results even if Serpstat and Google find nothing.

Here is how script processes keywords:

1. The script grabs some keywords and determines their "weight" according to their search volume. The higher search volume the keyword has, the more "weighty" it is. Then the script sums the search volume of keywords, where the required word/phrase is mentioned.

Search volume for search suggestions is "5". Moreover, "bad keywords" or exclusions, which you enter manually to the script, are also taken into account.

2. Then it grabs 2-word phrases and determines their "weight". The words in phrases are sorted by the alphabetic order to speed up the process.

3. Finally, script combines the newly gained data with that received at the previous sessions.
How to use this script?
Here is how the script looks:
To make script work correctly, it's preferable to fill all input boxes. But not all of them are required.

  • Keyword — required keyword

  • Search Engine — a search engine for which the analysis will be carried out. For example, for the US Google, you need to set the g_us. The entire list of available search engines can be found here.

Limit the maximum number of phrases from the organic issue, which will participate in the analysis. You cannot set more than 1000 here.

  • Default keys — list of two-word keywords. You should give each of them some "weight" to receive some kind of result if something goes wrong.

০ Format: type, keyword, "weight". Every keyword should be written from a new line.

০ Types:

w — one word

p — two words


"w; bottle; 50" — initial weight of word bottle is 50.

"p; plastic bottle; 30" — initial weight of phrase plastic bottle is 30.

"w; plastic bottle; 20" — incorrect. You cannot use a two-word phrase for the "w" type.

  • Bad words — comma-separated list of words you want the script to exclude from the results.

  • Token — here you need to enter your token for API access. It can be found on your profile page.

How to use the gained results?

The first 10 phrases after "RESULT" are keywords that are desirable to use in the text. Other 20 are up to you.

Don't use unreadable word forms offered by the script. Change the word order, add prepositions to make them readable.

You should understand that the gained results are just a bunch of words so that you can change the order of words in phrases and add prepositions to make them readable. For example, you can use "free backlinks checker" instead of "backlinks checker free". Or "backlinks with high pr" instead of "backlinks high pr".

It happens because the words are sorted by the alphabetic order for faster-obtaining data.

If you have some doubts that the gained results are not correct or there are some problems with the default settings, you can look at the list of the words and phrases that were used in parsing. Click on "Show more" at the very end of the page. Here is an example:
The keywords are sorted by their "weight" in descending order.

Tips on how to use these keywords

  • Include these keywords in H1, Title, and Description;

  • Add keywords to the image alt tag;

  • Integrate keywords into content naturally;

  • Don't highlight all keywords in bold;

  • Don't use too many keywords;

  • Create useful and interesting content for these keywords.


As tradition requires, I share this script with you. You can use online version:
Or you can download the source code:

Rate the article on a five-point scale

The article has already been rated by 2 people on average 5 out of 5
Found an error? Select it and press Ctrl + Enter to tell us

Share this article with your friends

Sign In Free Sign Up

You’ve reached your query limit.

Or email
Forgot password?
Or email
Back To Login

Don’t worry! Just fill in your email and we’ll send over your password.

Are you sure?


To complete your registration you need to enter your phone number


We sent confirmation code to your phone number

Your phone Resend code Queries left

Something went wrong.

Contact our support team
Or confirm the registration using the Telegram bot Follow this link
Please pick the project to work on

Personal demonstration

Serpstat is all about saving time, and we want to save yours! One of our specialists will contact you and discuss options going forward.

These may include a personal demonstration, a trial period, comprehensive training articles & webinar recordings, and custom advice from a Serpstat specialist. It is our goal to make you feel comfortable while using Serpstat.




We are glad of your comment
Upgrade your plan

Upgrade your plan

Export is not available for your account. Please upgrade to Lite or higher to get access to the tool. Learn more

Sign Up Free

Спасибо, мы с вами свяжемся в ближайшее время

View Editing


You have run out of limits

You have reached the limit for the number of created projects. You cannot create new projects unless you increase the limits or delete existing projects.

I want more limits
Open support chat