Keyword density is used to determine the number of times a keyword or keyword phrase occurs on a web page / section of content compared to the total number of words found. Many of us are not convinced keyword density is a very important metric for search engines. This is also my personal opinion, but on the other hand I’m convinced it can be used to find interesting insights.
So I’ve decided to make this piece of code publicly available, and in the meantime I’ll think about a useful way to use this functionality (or just a piece of it) as part of another tool.
About the PHP script
- Extracting content from a web page – Currently the script is able to process a string of words.
- Stop Words – You can add expand the list of stop words with relevant words for your language, just do a quick search on Google.
- Function – This code makes use of a function. This isn’t strictly necessary, but for future purposes I think it’s convenient.
- Generating output – The current code outputs tables using separate foreach loops. You can tinker with it and make it a little more dynamic. But for now I think it’s a good solution to make the code accessible and not over complicated.
To do list (future versions)
- Extracting content from a page
- Create a more advanced filter to remove non relevant (reading) characters, so they don’t mess with the output.
- Your suggestions…!
Current version V1
This isn’t the final version! When i’ve got some spare time I’ll work on the code and add the above features. In the meantime have fun with the code and check this page for future releases and updates.
Keyword density checker PHP script
Sample of the keywordSorting function. In bold you can find the explanation.
Question or suggestions?
Just let me know… And I’ll see what I can do!!PHP