How to add or create a counter on your web page
Putting a counter on a web page can help you track how many people visit it. There are several ways to go about putting a counter on your page, either by adding a pre-built one or creating your own.
We highly recommend using the Google's Analytics service over any web page counter, as it gives you a lot more valuable information.
Adding a pre-built counter
If you prefer to add a pre-built counter to your web page, here are a few ways to do so.
- Check with the web host for your web page. Often the company hosting your web page will offer a free solution and provide instructions on how to add the counter code to your web page.
- You can get a pre-built counter from websites that offer free counters, and add it to your web page with only a few lines of code. We recommend the following sites for free counters.
Example of the free-counter-plus counter
A counter like the one used above will increase in count if you or any visitor refreshes their browser.
Create a counter
If you want to create a counter, you need to create a Perl, PHP, or other script and either refer to that script through a server-side include or another method. We recommend that you already know or learn Perl or PHP programming to create the counter script.
The code for creating a counter can vary, depending on the programming language used and the type of counter you want to add to your web page. Below are some web pages that offer sample counter script code, which you can use as a guide to creating a counter.
We have not tested the sample counter scripts provided on these web pages, so we cannot guarantee they are bug-free and will work for you.
- How can I get more traffic or people to visit my website?
- See the traffic and hit for further information about these terms and related links.
- HTML help and support.