Introduction

Counterize is a counter and statistics plugin for WordPress that doesn’t use external libraries. Download Counterize!

Features

  • Hourly, daily, weekly and monthly traffic stats
  • Popular pages and posts stats
  • IP addresses stats
  • Countries stats
  • Referrers stats
  • Accurate browsers stats (browser name and version)
  • Accurate operating system stats (operating system name, version and platform)
  • Keywords stats
  • Powerful history with filters let you find precisely what you’re looking for
  • Email reports
  • Integration in the WordPress toolbar
  • No flash, no external library needed
  • Extensible thanks to WordPress actions and filters
  • Dashboard widget for a quick overview of your blog statistics
  • Complete API to use the data of Counterize charts as you like
  • An administration interface using the new WordPress Settings API is available, as well as a dashboard with detailed informations and statistics
  • The users that are authorized to display the Counterize dashboard can be defined using WordPress capabilities
  • It can display statistics in your pages and posts (visit this webpage for a demo)

Version 3 of Counterize is doing its best to be compatible with the latest release of WordPress, but this is still a work-in-progress. Feel free to report any incompatibility! Also, please note that Counterize is only guaranteed to work correctly on the latest version of WordPress.

You are welcome to propose your translation for Counterize, please follow this guide. I am not a native English speaker, so your help for a better English translation would be appreciated as well.

Here is a very short demo of what Counterize can do:

Top 3 operating systems ‪(3)‬

  Operating systems Amount Percentage
[ + ] Windows Windows 261390   89.53 %
  Unknown Unknown 16285   5.58 %
[ + ] Mac OS Mac OS 14280   4.89 %

Counterize is a fork of Counterize II by Steffen Forkmann (http://www.navision-blog.de/counterize) who kindly gave us the permission to continue the development of his plugin. It has since evolved to a more complete and powerful plugin, and almost doesn’t share common code anymore.

Counterize API

After you have installed the Counterize plugin, you can see a lot of diagrams on the Counterize Dashboard page (Dashboard/Counterize).

Most likely you’d like to have a counter somewhere on your pages, showing the number of visitors or similar.
Here’s an overview of the functions which can be used anywhere in your WordPress blog:

Traffic functions

counterize_getamount()                 // Returns the total hits seen by Counterize.
counterize_getpagesamount()            // Returns the total pages/posts views.
counterize_gethitstoday()              // Returns the total hits registered today.
counterize_get_online_users()          // Returns the number of currently online users.
counterize_getlatest7days()            // Returns the total amount of hits from the last 7 days.
counterize_getuniqueamount()           // Returns the total unique IP's that's been seen.
counterize_getfromcurrentip()          // Returns the total hits from the IP that's visiting.
counterize_getuniquehitstoday()        // Returns the number of different IP's registered today.
counterize_gethitstodayfromcurrentip() // Returns the daily hits from the IP that's visiting.
counterize_current_post_hits()         // Get number of hits on current post/page.
counterize_return_first_hit()          // Returns the date of the first registered entry in the database.
$counterize_plugins['traffic']->counterize_get_hits()                     // Output an HTML table with statistics about hits.
$counterize_plugins['traffic']->counterize_feed_daily_stats()             // Get the daily stats data feed.
$counterize_plugins['traffic']->counterize_render_daily_stats()           // Render the daily stats data feed.
$counterize_plugins['traffic']->counterize_feed_monthly_stats()           // Get the monthly stats data feed.
$counterize_plugins['traffic']->counterize_render_monthly_stats()         // Render the monthly stats data feed.
$counterize_plugins['traffic']->counterize_feed_weekly_stats()            // Get the weekly stats data feed.
$counterize_plugins['traffic']->counterize_render_weekly_stats()          // Render the weekly stats data feed.
$counterize_plugins['traffic']->counterize_feed_week_progression_stats()  // Get the progression between the last current week stats data feed.
$counterize_plugins['traffic']->counterize_render_week_progression_stats()// Render the progression between the last current week stats data feed.
$counterize_plugins['traffic']->counterize_feed_hourly_stats()            // Get the hourly stats data feed.
$counterize_plugins['traffic']->counterize_render_hourly_stats()          // Render the hourly stats data feed.

Referrers functions

counterize_getuniquereferers()                                              // Returns the amount of unique referrers that have been recorded.
$counterize_plugins['referers']->counterize_feed_most_seen_referers()       // Gets the most seen referrers data feed.
$counterize_plugins['referers']->counterize_render_most_seen_referers()     // Renders the most seen referrers data feed.
$counterize_plugins['referers']->counterize_feed_most_seen_referers24hrs()  // Gets the most seen referrers data feed for the last 24 hours.
$counterize_plugins['referers']->counterize_render_most_seen_referers24hrs()// Renders the most seen referrers data feed for the last 24 hours.

Pages and Posts functions

counterize_getuniqueURL()                                                 // Returns the amount of unique URL's that have been shown.
$counterize_plugins['pages']->counterize_feed_most_requested_urls()       // Gets the most requested URLs data feed.
$counterize_plugins['pages']->counterize_render_most_requested_urls()     // Renders the most requested URLs data feed.
$counterize_plugins['pages']->counterize_feed_most_requested_urls24hrs()  // Gets the most requested URLs data feed for the last 24 hours.
$counterize_plugins['pages']->counterize_render_most_requested_urls24hrs()// Renders the most requested URLs data feed for the last 24 hours.
$counterize_plugins['pages']->counterize_feed_most_popular_posts()        // Gets the most popular posts/pages data feed.
$counterize_plugins['pages']->counterize_render_most_popular_posts()      // Renders the most popular posts/pages data feed.
$counterize_plugins['pages']->counterize_feed_most_popular_posts24hrs()   // Gets the most popular posts/pages data feed for the last 24 hours.
$counterize_plugins['pages']->counterize_render_most_popular_posts24hrs() // Renders the most popular posts/pages data feed for the last 24 hours.

IP addresses functions

$counterize_plugins['ip']->counterize_feed_most_active_ips()       // Gets the most active IP addresses data feed.
$counterize_plugins['ip']->counterize_render_most_active_ips()     // Renders the most active IP addresses data feed.
$counterize_plugins['ip']->counterize_feed_most_active_ips24hrs()  // Gets the most active IP addresses data feed of the last 24 hours.
$counterize_plugins['ip']->counterize_render_most_active_ips24hrs()// Renders the most active IP addresses data feed of the last 24 hours.

Keywords functions

$counterize_plugins['keywords']->counterize_feed_most_searched_keywords()       // Gets the most searched keywords data feed.
$counterize_plugins['keywords']->counterize_render_most_searched_keywords()     // Renders the most searched keywords data feed.
$counterize_plugins['keywords']->counterize_feed_most_searched_keywords24hrs()  // Gets the most searched keywords data feed for the last 24 hours.
$counterize_plugins['keywords']->counterize_render_most_searched_keywords24hrs()// Renders the most searched keywords data feed for the last 24 hours.

Countries functions

$counterize_plugins['keywords']->counterize_feed_most_visiting_countries()       // Gets the most visiting countries data feed.
$counterize_plugins['keywords']->counterize_render_most_visiting_countries()     // Renders the most visiting countries data feed.
$counterize_plugins['keywords']->counterize_feed_most_visiting_countries24hrs()  // Gets the most visiting countries data feed for the last 24 hours.
$counterize_plugins['keywords']->counterize_render_most_visiting_countries24hrs()// Renders the most visiting countries data feed for the last 24 hours.

Browsers functions

counterize_getuniquebrowsers()                                                         // Returns the amount of unique browser strings that have visited your blog.
$counterize_plugins['browsers']->counterize_feed_most_used_browsers_collapsible()      // Gets the most used browsers data feed with detailed version statistics for each item.
$counterize_plugins['browsers']->counterize_render_most_used_browsers_collapsible()    // Renders the most used browsers data feed with detailed version statistics for each item.
$counterize_plugins['browsers']->counterize_feed_most_used_browsers_without_version()  // Gets the most used browsers without version data feed.
$counterize_plugins['browsers']->counterize_render_most_used_browsers_without_version()// Renders the most used browsers without version data feed.
$counterize_plugins['browsers']->counterize_feed_most_used_browsers()                  // Gets the most used browsers data feed.
$counterize_plugins['browsers']->counterize_render_most_used_browsers()                // Renders the most used browsers data feed.

Operating systems functions

$counterize_plugins['os']->counterize_feed_most_used_os_collapsible()      // Gets the most used os data feed with detailed version statistics for each item.
$counterize_plugins['os']->counterize_render_most_used_os_collapsible()    // Renders the most used os data feed with detailed version statistics for each item.
$counterize_plugins['os']->counterize_feed_most_used_os_without_version()  // Gets the most used os without version data feed.
$counterize_plugins['os']->counterize_render_most_used_os_without_version()// Renders the most used os without version data feed.
$counterize_plugins['os']->counterize_feed_most_used_os()                  // Gets the most used os data feed.
$counterize_plugins['os']->counterize_render_most_used_os()                // Renders the most used os data feed.

Actions

  • counterize_show_data : Let plugins show their data into the “Counterize” sub-menu page.
  • counterize_after_includes : Happens right after Counterize included its files.
  • counterize_before_insert_into_database: Let plugins do something just before some data is inserted into the database.
  • counterize_after_insert_into_database : Let plugins do something just after some data is inserted into the database.
  • counterize_init : Let plugins add a hook into Counterize initialization procedure.
  • counterize_before_install : Let plugins do something just before installation.
  • counterize_after_install : Let plugins do something just after installation.

Filters

  • counterize_before_includes : Let plugins filter which files are included.
  • counterize_server_remote_addr : Let plugins filter the $_SERVER['REMOTE_ADDR'] value.
  • counterize_server_http_user_agent : Let plugins filter the $_SERVER['HTTP_USER_AGENT'] value.
  • counterize_server_request_uri : Let plugins filter the $_SERVER['REQUEST_URI'] value.
  • counterize_server_referer : Let plugins filter the $_SERVER['HTTP_REFERER'] value.
  • counterize_server_this_url : Let plugins filter the $this_url variable.
  • counterize_bot_array : Let plugins filter the bot array.
  • counterize_check_insert_into_database : Let plugins add their own conditions for determining if data should be inserted into the database.
  • counterize_check_data : let plugins add their own diagrams.
  • counterize_shortcodes : let plugins add their own shortcodes.
  • counterize_dashboard_add_submenu : let plugins add their own sub menu.
  • counterize_mce_js_before_form_filter : let plugins output something before the form of the Counterize modal dialog in the Visual editor.
  • counterize_mce_js_before_fields_filter: let plugins output something before the fields of the Counterize modal dialog in the Visual editor.
  • counterize_mce_js_type_filter : let plugins add more type items in the Counterize modal dialog in the Visual editor.
  • counterize_mce_js_period_filter : let plugins add more period items the Counterize modal dialog in the Visual editor.
  • counterize_mce_js_after_fields_filter : let plugins output something after the fields of the Counterize modal dialog in the Visual editor.
  • counterize_mce_js_after_form_filter : let plugins output something after the form of the Counterize modal dialog in the Visual editor.
  • counterize_mce_js_options_filter : let plugins add/modify attributes and their defaults for the Counterize modal dialog in the Visual editor.
  • counterize_mce_js_radiobutton_filter : let plugins add/modify the list of attributes of type “radio button” for the Counterize modal dialog in the Visual editor.
  • counterize_mce_js_checkbox_filter : let plugins add/modify the list of attributes of type “checkbox” for the Counterize modal dialog in the Visual editor.
  • counterize_report : let plugins output some content in the email reports
  • counterize_report_what_filter : let plugins add some items in the list used to generate email reports

Shortcodes

You can insert a Counterize diagram using the Counterize button in your Visual editor. The most basic shortcode is:

[counterize]

This will display a short copyright notice.

All the attributes are optional. The following attributes and their values are currently available:

  • type: String. Valid values are:
    • copyright“: Shows a copyright notice (default value)
    • browsers“: Browsers diagrams
    • os“: Operating systems diagrams
    • countries“: Countries diagrams
    • ip“: IP addresses diagrams
    • hosts“: Host-names diagrams (only available if enabled in the settings)
    • outlinks“: Out-links diagrams
    • exitpages“: Exit pages diagrams
    • keywords“: Keywords diagrams
    • referers“: Referrers diagrams
    • domains“: Domains diagrams
    • hits“: Hits table
    • hourly“: Hourly stats diagrams
    • daily“: Daily stats diagrams
    • weekly“: Weekly stats diagrams
    • monthly“: Monthly stats diagrams
    • all“: All tables and diagrams
  • items: Positive and non-zero integer that represents the number of items to display in the diagram. Default value: 10
  • subitems: Positive and non-zero integer that represents the number of sub-items to display in the diagram. Only effective with collapsible diagrams. Default value: 15
  • version: String. Set to “yes” to display diagrams with version information, “no” otherwise. Only effective with Browsers and OS diagrams. Default value: “yes”
  • collapsible: String. Set to “yes” to display collapsible diagrams with each item containing child items, “no” otherwise. Only effective with Browsers and OS diagrams. Default value: “no”
  • print_header: String. Set to “yes” to display a header above the diagram, “no” otherwise. Default value: “yes”
  • header: String. Set to non-empty string to override the default header. Default value: empty string
  • period: String. Valid values are:
    • (empty string): No period limit (default value)
    • 24h“: Limit data to the latest 24 hours. Available for most diagrams except the Traffic ones
    • onlytoday“: Limit data to today only. Available for Traffic diagrams
    • onlythisweek“: Limit data to this week only. Available for Traffic diagrams
    • onlythismonth“: Limit data to this month only. Available for Traffic diagrams
    • onlythisyear“: Limit data to this year only. Available for Traffic diagrams
  • tn_width: Positive and non-zero integer. Width of the post thumbnail. Default value: 50
  • tn_height: Positive and non-zero integer. Height of the post thumbnail. Default value: 50

Development status

Legend: [status, priority] Description

  • [wip, medium] Make a Counterize widget
  • [10%, low] Add some sorting options (by label for example)
  • [ 0%, medium] Get rid of pre-3.0.0 installation scripts
  • [ 0%, medium] A new installation should have its own installation script (currently upgrading from 1.0.0 to 3.x.x…)
  • [ 0%, low] To be able to resize and move charts in the dashboard (but I consider it not urgent)
  • [ 0%, low] Using the HighCharts library as an alternative fancier display
  • [ 0%, medium] Making a standalone version of Counterize. That would allow to port it to other platforms (Drupal, Magento…).
  • [ 0%, high] Allow wildcard characters support in IP address exclusion list
  • [ 0%, high] Solve time zones problems as many reported it
  • [ 0%, high] Reduce the Counterize footprint on database [BIG JOB AS ALL QUERIES MUST BE RE-WRITTEN]
  • [ 0%, medium] Send daily, weekly or monthly reports by email
  • [ 0%, medium] Better IP exclusion list handling
  • [ 0%, low] Add more function to count unique visitors, in a similar way as hits
  • [ 0%, high] Move some Counterize functions into their respective plugins
  • [ 0%, medium] Add screen size statistics

See Counterize in action

You can see Counterize in action in the bottom of our website pages, and also on this demo page.

FAQ

Q: I know that I have incoming traffic but  Counterize stats stay at zero. Why?

A: There is probably a problem somewhere, so I will need you to do the following:

  •  Open your wp-config.php file
  • Ensure that WP_DEBUG is set to true. The line should be “define( ‘WP_DEBUG’, false );”
  • Add the following lines just after:
error_reporting( E_ALL | E_STRICT );
ini_set('display_errors', 1);
  • Reload your website in your browser
  • Tell me about any errors, warnings and notices you see, if any
  • If no errors are shown, then you probably do not have incoming traffic…

Q: Why aren’t the IP of my visitors logged?

A: You need to enable the option in the Counterize settings. It is disabled by default. 

Q: How to translate Counterize in my language?

A: Please follow these instructions

Q: Can I extend Counterize?

A: Yes. Counterize is now modularizable and you can add your own Counterize plugin. Counterize also provides several action and filter hooks.

Q: Can Counterize replace Google Analytics?

A: Not yet. But it’s a good addition/alternative. 

Q: What are the minimum requirements to run Counterize?

A: The same requirements than the current stable version of WordPress, so for example PHP 5 is required, but as with each supplementary plugin, it will use more RAM, so take this into account.
Counterize is also known to take a lot of database space in its current version, especially if your website is very visited.

Q: I see an error message like “The script whose uid is 12345 is not allowed to access /var/tmp/” or “Warning: session_start() [function.session-start]: Cannot send session cache limiter – headers already sent“, HELP!

A: Try adding the following 3 lines just after the PHP start tag of your wp-config.php:

if( ! isset( $_SESSION ) )
{
	session_start();
}

Also, make sure the session.save_path in your php.ini is set and point to a valid path. Please read this article for more details about this issue.

Q: Do you provide support for Counterize?

A: Sometimes, I can provide BASIC support for free. It mostly depends on my free time, because Counterize is developed on my free time too.
Nobody likes to work for peanuts, so do not expect professional level support for free.
If you need a better support or something is urgent, please contact me to discuss of a price. 

Get Counterize

Download Counterize!