WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Counterize

Counter and statistics plugin for WordPress.

Migration from Counterize II

  1. Do some backup in case of problems
  2. Deactivate Counterize II on the Plugins menu in WordPress
  3. Unzip the package and upload the folder counterize to /wp-content/plugins/.
  4. Activate the plugin through the Plugins menu in WordPress.
  5. Go to Counterize on Options page, configurate your settings. Save the settings

Counterize uses the same tables than Counterize II so you won't loose your data. You can proceed to the migration safely and benefit from the numerous improvements in Counterize.

Reporting bugs

If you encounter a bug, please send us a descriptive report of what happened, with the error messages if any.

Many thanks to

  • Steffen Forkmann (author of Counterize II from which this plugin is based from)
  • Carsten Becker (German translation, WP 3.x integration)
  • Can Aydemir (Turkish translation)
  • Helmutt Hoffman (found some bugs and proposed solutions)
  • Spela Golob Peterlin (Slovenian translation)
  • Emale (Right-to-left compatibility)
  • software77.net (IP to country database, http://software77.net/geo-ip/)
  • phptutorial.info (PHP version of software77 database, http://www.phptutorial.info/iptocountry/the_script.html)
  • Iman Nurchyo (counterize_browsniff.php is based on his WordPress Browser Detection Plugin)
  • Daniel from chaosonline.de (for his much appreciated help in the Counterize upgrade script)
  • Greg Froese (for his contributions)
  • José Delgado (Spanish translation)
  • Gérard (HTTPS links fix)
  • Subhash and terrah for their fix of the counterize_current_post_hits() function
  • Tomáš Losák (CZ translation)
  • lisss (Russian translation)
  • Hacko (Bulgarian translation)
  • Ahrale Shrem (Hebrew translation)
  • Vadym Shvachko (Ukrainian translation + non-ASCII characters fix)

Special thanks to them for their donation

  • Billy Willoughby
  • Nancy Harkey
  • Opulentia
  • Dr. Houston David Hughes
  • Christy Chauvin
  • Matt Mikka

TODO list

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

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.

Depending on where you use the Counterize plugins functions in your theme, you may have to add the following line before:

global $counterize_plugins;

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(): Gets number of hits on current post/page.
  • counterize_return_first_hit(): Returns the date of the first registered entry in the database.
  • counterize_get_hits(): Outputs an HTML table with statistics about hits.
  • $counterize_plugins['traffic']->counterize_feed_daily_stats(): Gets the daily stats data feed.
  • $counterize_plugins['traffic']->counterize_render_daily_stats(): Renders the daily stats data feed.
  • $counterize_plugins['traffic']->counterize_feed_monthly_stats(): Gets the monthly stats data feed.
  • $counterize_plugins['traffic']->counterize_render_monthly_stats(): Renders the monthly stats data feed.
  • $counterize_plugins['traffic']->counterize_feed_weekly_stats(): Gets the weekly stats data feed.
  • $counterize_plugins['traffic']->counterize_render_weekly_stats(): Renders the weekly stats data feed.
  • $counterize_plugins['traffic']->counterize_feed_week_progression_stats(): Gets the progression between the last current week stats data feed.
  • $counterize_plugins['traffic']->counterize_render_week_progression_stats(): Renders the progression between the last current week stats data feed.
  • $counterize_plugins['traffic']->counterize_feed_hourly_stats(): Gets the hourly stats data feed.
  • $counterize_plugins['traffic']->counterize_render_hourly_stats(): Renders the hourly stats data feed.

Referers functions

  • counterize_getuniquereferers(): Returns the amount of unique referers that have been recorded.
  • $counterize_plugins['referers']->counterize_feed_most_seen_referers(): Gets the most seen referers data feed.
  • $counterize_plugins['referers']->counterize_render_most_seen_referers(): Renders the most seen referers data feed.
  • $counterize_plugins['referers']->counterize_feed_most_seen_referers24hrs(): Gets the most seen referers data feed for the last 24 hours.
  • $counterize_plugins['referers']->counterize_render_most_seen_referers24hrs(): Renders the most seen referers 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 sthe 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['countries']->counterize_feed_most_visiting_countries(): Gets the most visiting countries data feed.
  • $counterize_plugins['countries']->counterize_render_most_visiting_countries(): Renders the most visiting countries data feed.
  • $counterize_plugins['countries']->counterize_feed_most_visiting_countries24hrs(): Gets the most visiting countries data feed for the last 24 hours.
  • $counterize_plugins['countries']->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 determinating 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

Removed functions

The following functions have been removed and should not be used anymore:

  • counterize_most_visited_pages()
  • counterize_most_visited_pages24hrs()
  • counterize_most_requested_urls()
  • counterize_most_requested_urls24hrs()
  • counterize_most_popular_posts()
  • counterize_most_popular_posts24hrs()
  • counterize_most_visited_referrers()
  • counterize_most_visited_referrers24hrs()
  • counterize_most_visited_IPs()
  • counterize_most_visited_IPs24hrs()
  • counterize_most_visiting_countries()
  • counterize_most_visiting_countries24hrs()
  • counterize_most_searched_keywords()
  • counterize_most_searched_keywords_today()
  • counterize_most_used_browsers()
  • counterize_most_used_browsers_without_version()
  • counterize_most_used_browsers_collapsible()
  • counterize_most_used_os()
  • counterize_most_used_os_without_version()
  • counterize_most_used_os_collapsible()
  • counterize_feed_daily_stats()
  • counterize_render_daily_stats()
  • counterize_feed_monthly_stats()
  • counterize_render_monthly_stats()
  • counterize_feed_weekly_stats()
  • counterize_render_weekly_stats()
  • counterize_feed_week_progression_stats()
  • counterize_render_week_progression_stats()
  • counterize_feed_hourly_stats()
  • counterize_render_hourly_stats()
  • counterize_feed_most_seen_referers()
  • counterize_render_most_seen_referers()
  • counterize_feed_most_seen_referers24hrs()
  • counterize_render_most_seen_referers24hrs()
  • counterize_feed_most_requested_urls()
  • counterize_render_most_requested_urls()
  • counterize_feed_most_requested_urls24hrs()
  • counterize_render_most_requested_urls24hrs()
  • counterize_feed_most_popular_posts()
  • counterize_render_most_popular_posts()
  • counterize_feed_most_popular_posts24hrs()
  • counterize_render_most_popular_posts24hrs()
  • counterize_feed_most_active_ips()
  • counterize_render_most_active_ips()
  • counterize_feed_most_active_ips24hrs()
  • counterize_render_most_active_ips24hrs()
  • counterize_feed_most_searched_keywords()
  • counterize_render_most_searched_keywords()
  • counterize_feed_most_searched_keywords24hrs()
  • counterize_render_most_searched_keywords24hrs()
  • counterize_feed_most_visiting_countries()
  • counterize_render_most_visiting_countries()
  • counterize_feed_most_visiting_countries24hrs()
  • counterize_render_most_visiting_countries24hrs()
  • counterize_feed_most_used_browsers_collapsible()
  • counterize_render_most_used_browsers_collapsible()
  • counterize_feed_most_used_browsers_without_version()
  • counterize_render_most_used_browsers_without_version()
  • counterize_feed_most_used_browsers()
  • counterize_render_most_used_browsers()
  • counterize_feed_most_used_os_collapsible()
  • counterize_render_most_used_os_collapsible()
  • counterize_feed_most_used_os_without_version()
  • counterize_render_most_used_os_without_version()
  • counterize_feed_most_used_os()
  • counterize_render_most_used_os()

Statistics in your posts and pages

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": Hostnames diagrams (only available if enabled in the settings)
    • "outlinks": Outlinks diagrams
    • "exitpages": Exit pages diagrams
    • "keywords": Keywords diagrams
    • "referers": Referers 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 subitems 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 fpr Traffic diagrams
    • "onlythisweek": Limit data to this week only. Available fpr Traffic diagrams
    • "onlythismonth": Limit data to this month only. Available fpr Traffic diagrams
    • "onlythisyear": Limit data to this year only. Available fpr 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

Deprecated

You can use the following codes in HTML mode when editing your post or page, where 'xx' can be replaced by any integer greater than 0:

  • <!-- counterize_stats -->
  • <!-- counterize_stats_hits -->
  • <!-- counterize_stats_browsers_xx -->
  • <!-- counterize_stats_browsers_nover_xx -->
  • <!-- counterize_stats_browsers_mixed_xx_xx -->
  • <!-- counterize_stats_os_xx -->
  • <!-- counterize_stats_os_nover_xx -->
  • <!-- counterize_stats_os_mixed_xx_xx -->
  • <!-- counterize_stats_urls_xx -->
  • <!-- counterize_stats_urls_24hrs_xx -->
  • <!-- counterize_stats_posts_xx -->
  • <!-- counterize_stats_posts_24hrs_xx -->
  • <!-- counterize_stats_referers_xx -->
  • <!-- counterize_stats_referers_24hrs_xx -->
  • <!-- counterize_stats_ip_xx -->
  • <!-- counterize_stats_ip_24hrs_xx -->
  • <!-- counterize_stats_countries_xx -->
  • <!-- counterize_stats_countries_24hrs_xx -->
  • <!-- counterize_stats_keywords_xx -->
  • <!-- counterize_stats_keywords_today_xx -->
  • <!-- counterize_stats_copyright -->

You can also use #- and -# instead of <!-- and -->.

You can visit this webpage for a more descriptive example.

botlist.txt

Counterize provides a botlist.txt file. This file is a list of things that should not be counted in the statistics. It is also used to delete bots manually after you edited it.

There are three kind of lines you can find in botlist.txt:

  • Lines containing part or all of the user-agent to block, without any escaping. If a user-agent contains one of this kind of lines, it will be blocked. Example: "bot"
  • Lines containing regular expressions. They must be of the following format, without the quotes: regexp:my_regular_expression_pattern. Example: regexp:#^Mozilla/5\.0 \(compatible$# will match exactly the "Mozilla/5.0 (compatible" malformed user-agent.
  • Lines containing complex filters. They must be of the following format: complexfilter:Suspicious_complete_user_agent_string###requested_url###Complete_referer_string. "requested_url" can also be "*" if the bot goes to several pages. If "Complete_referer_string" is "%HTTP_HOST%", it will be replaced by the complete URL of your website (eg: http://www.yourwebsite.com/). If "Complete_referer_string" is "unknown", it means the referer is empty. Here is an example of complex filter: complexfilter:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)###/comment-page-1/###%HTTP_HOST% will block any user-agent equal to "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" accessing "/comment-page-1/" with the referer "http://www.yourwebsite.com/". Another example: complexfilter:Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)###*###unknown will block the "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)" user-agent accessing any pages with an empty referer. Complex filters are powerful, use with caution!

You can add your own lines in the file user_botlist.txt. You may create this file if it doesn't exist.

Requires: 3.3.0 or higher
Compatible up to: 3.5.0
Last Updated: 2013-1-16
Downloads: 174,220

Ratings

4 stars
4.4 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1 100,1,1 100,1,1 100,1,1 100,1,1 100,1,1
100,1,1
100,1,1 50,2,1 100,1,1 100,1,1
100,7,7
100,1,1 100,1,1
100,1,1 100,1,1 100,1,1 100,6,6
50,2,1
100,1,1
67,3,2
67,3,2
0,3,0 100,2,2 100,3,3
100,4,4
67,3,2
0,1,0
33,3,1