Hits & Visits

This plugin logs hits and visits to your website.

You can view the total number of visits and hists, hits per page, referers, user agents and visit durations of the visitors of your web site.

Version 2.1 also offers a world map showing the visitors by country:

More screenshots can be found here.

Installation

Download the plugin from http://get-simple.info/extend/plugin/hitcount/91/ and unzip it to the plugins directory of your GetSimple installation.

The plugin will try to create a directory /data/other/hitcount, however, this might fail depending on your hoster. If you don't get hits or error messages are shown,

  • create directories hitcount and hitcount_index in /data/other with mode 0777
  • if you use Apache, create a .htaccess file with "DENY FROM ALL" in these directories

Usage

You can use the functions return_hitcount_hits(return_page_slug()) and return_hitcount_visits() to display hits of the current page and visits on your site.

This page was hit 17792 times. The hits can be included in the page content with the help of the DynPages plugin and a component hits like this:

<?php echo return_hitcount_hits(return_page_slug()); ?>

In the GetSimple administration you can analyze the hits and visits on the Support tab - Hits & Visits.

There you can also export them as CSV or Excel file.

Blacklisting

If you create a file /data/other/hitcount_blacklist.txt with IP addresses separated by blanks or newlines, hits from these IP addresses will not be counted.

(2.1+) Select Blacklist my browser in the GetSimple administration, Support/Hits & Visits, bottom of page.

Counting Page Hits on Other Sites

To count page hits on another site, you can include a call to hitcount on the other site:

<!-- a spacer gif -->
<img src="http://my.domain/plugins/hitcount/ping/ping.php?from=somewhere" />
<!-- or an empty javascript file -->
<script type="text/javascript" src="http://my.domain/plugins/hitcount/ping/ping.php?from=somewhere&amp;js"></script>
<!-- or an empty css file -->
<link rel="stylesheet" type="text/css" href="http://my.domain/plugins/hitcount/ping/ping.php?from=somewhere&amp;css" />

(2.1+) Now these hits are also logged in the log.

Counting File Downloads

You can count file downloads by installing the Download Interceptor plugin and diverting downloads to the interceptor via the .htaccess configuration, e.g.

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^data/uploads/(.*)$ plugins/download_interceptor/intercept.php?file=$1 [L]

Determine Visitor Countries

To determine the countries of visitors, go to Support - Hits & Visitors and select Download IP to country database. This will create the files /data/other/ip2country.txt and /data/other/countries.txt. From then on the plugin tries to determine the visitors' countries.

You can view the visitors' countries by selecting the Countries tab. You can also view a world map by selecting Show world map at the bottom of the page.

Compatibility (the world map uses a scripted embedded SVG file):

  • Firefox 11: World map including country information (titles) works correctly (worldmap popup is not initially vertically centered)
  • Chrome 18, IE 9, Opera 11: World map displays correctly, but no country information is shown
  • Safari 5.1.5: World map displays correctly, but no country information is shown (worldmap popup has scroll bars)