Sunday, September 1, 2021

Track Visitor Stats - Revisited

Track Your Website Visitors... Easy!

About a year ago I wrote a simple script to track my website visitors. I did this mostly because most of the information I needed could easily be captured by my own website using php or javascript. And, there was enough "free" IP location services available that could tell me where my visitors were coming from. That script worked well, but was very basic in functionality and appearance. I recently changed my hosting company and in the process of changing over some of my websites, I decided to update the visitor tracker. It has now been renamed Imprint, and features much more functionality and improved appearance.

The script creates a polished user interface for displaying your IP visitor stats, and works with a number of IP location services available. If you don't subscribe to any IP location service, the script uses the ip2location lite databases freely available from For more information on your visitors, you can subscribe to the Maxmind GeoIP OMNI Web Service for as little as $20 for 10,000 lookups. The 10,000 lookups translates to a lot of visitors, as the script only looks up the visitor info on the first visitor and stores it for use on subsequent visits. Alternatively, you can also sign up for the IPInfoDB service freely available at The script uses this service as a backup if visitor info is not located in the other databases.

So, your website looks fantastic! You've invested a huge amount of time and a little money getting it up and running! You've had a few visitors, you think. Not many people buying anything, or leaving comments. Just how many people are visiting your site? Where are they coming from? Are they new visitors, or returning visitors? What pages are they going to? What pages are they coming from? What pages are the most popular? What pages are your visitors not even bothering to look at?

That's the kind of questions you ask yourself when you have a website intended to drive traffic and sales. 

Since websites first appeared, people have analyzed what was happening with their sites. It started with simple counters on personal pages to track the number of visitors. But now, website owners are looking for more sophisticated statistics. Today, stats are the essential tool to measure and manage a business or a website successfully.

So, you want to know more about your visitors and where they are coming from, where they are going on your site, and how many times they have visited. This PHP script will provide all that information and more.

View DEMO for TrackIP

Installing the script is very easy. The script is essentially self-contained. Other than placing a simple link to the tracking file on the page you want to track, you don't have to do anything else. You don't have to mess with databases at all. The script makes use of the sqlite3 database available in most PHP installations.

To install and use this script (assumes you are using PHP):

1) Unzip and copy the trackIP directory to a directory on your website:  i.e.: <YOUR PATH>/trackIP.
2) Include a path on pages you want to track to the javascript script to set cookies on users PC. i.e.:

        <script type='text/javascript' src='<YOUR PATH>/trackIP/js/trackIP.js'></script>

3) Include a path to trackip.php script on pages you want to track, i.e.:

        <?php include('<YOUR PATH>/trackIP/trackip.php'); ?>

4) Set file permissions of the trackIP directory and files to 755. !!Important!!

That's it! All your visitors will be tracked and the stats will be stored in a simple sqlite3 database. No messing with MYSQL databases at all.

If you have a header file, for instance, that is included in each page, copy the link to trackip.php in that file and it will capture all the pages.

To view the visitor stats is just as easy. Just create a blank php file. You can call it "visitors.php" and include the following line:

include("<YOUR PATH>/trackIP/visitors.php");

On the visitors page, click on the IP address to learn more about the particular visitor. I've been using this script for a few months now and it has given me a wealth of information and has lead to improved creative direction and sales.

 The script makes use of Greybox technology by Skeletonz to display the IP information, and a language script by Harald Hope.

Using Cron For Smoother, Faster Operation

Normally, the visitor script updates the location information when it is opened. If you haven't viewed visitor information for awhile, it may take some time for the visitor info to refresh. To improve performance, you can use cron to update the visitor stats while offline. This way, the latests visitor information is always readily, and quickly, available. If you haven't used a cron service before, you may have to speak to your website administrator about setting up the script. It's easy, but can be daunting if you haven't done it before.

Use the following cron setting to update every five minutes using PHP 5.4
Replace USERNAME and the path to update.php as necessary. You will probably have to change the path to php as well, usually '/usr/bin/php', but it may be different on your server. Check with your website administrator if you do not know how to set up a cron.

The line below will update the visitor information every 5 minutes.

*/5 * * * * /opt/php54/bin/php -q /home/<USERNAME>/public_html/trackIP/update.php >/dev/null 2>&1 

 Visitor Information 

So what are you going to find out about your visitors using this script. How about:

  • What countries your Web visitors are surfing from
  • What city / state or province are your visitors from
  • What time did they visit
  • How many times have this visit been to your site
  • How many visitors have you had to your site
  • What pages your visitors start their visit on
  • What pages your visitors go to next
  • What sites are sending visitors to you
  • What search words are being used to find your site
  • What type of ISP is being used: ie: residential, business, college, etc
  • What is the name of the organization, if any
  • What browsers your visitors use
  • Are your visitors using a mobile phone
  • What kind of computers (OS) are your visitors using to surf the Web
  • What screen resolutions your visitors set their monitors to
  • Does your visitor have JavaScript turn on
  • What is your visitors IP address
  • What time zone are your using in
  • What language are your visitors using

Not all this information will necessarily be available. Some of it is obtained through cookies placed on the user's PC. If cookies are turned off, some information will not be gathered. But, for the most part, only the search bots disable javascript and don't allow cookies.

Additional Features

Sometimes you may need or want to control who you are tracking, or ban certain IP addresses from your site altogether. You can do this and more from the main visitor screen. For example:

  • You can delete selected IP addresses
  • You can stop tracking of selected IP addresses
  • You can ban selected IP addresses
  • You can ban selected countries from visiting your site
  • You can mark selected IP addresses as search bots
  • Hide bots
  • Filter on specific country
  • View the raw database
  • Configure Imprint

Pay close attention to your stats and easily chart what your users are doing over time. You can see what your site visitors are reading and what keeps them coming back for more. You can see what your visitors find the most important. Or not important at all. You can then use this information to improve sales, which is really what this is all about. Isn't it?

Learning about your visitors and using this information as a guide is the best way to make sound marketing decisions.

Purchase the script now for only $24.95 and start tracking your visitors. 

Purchase TrackIP v2.0 Now

delicious digg facebook stumble twitter myspace linkedin technorati reddit google springpad blogger | addthis Share More...

speak your mind

If you have something to say, we would love to hear from you.

Disabled due to spam




inbox marketing
web solutions



Get occasional email updates from kidmoses


Donations of any size to this website are greatly appreciated.

copyright © 2004 to the present day | web design by KidMoses
privacy | terms | login | contact
windsor home inspections