Count website visits professionally with WP Statistics

Hello everyone, in today’s article I will guide you to use the WP Statistics plugin to count the number of visitors to the website. In addition to Google Analytics, this is one of the most popular plugins that people often use to count visits to wordpress websites

For regular users who need a better function to count post views, along with displaying the full number of views, in this article I will introduce to you the WP Statistics plugin and how to display the number of views outside the article. If you are a programmer, you can also use this plugin because it supports many shortcodes and functions to customize as desired.

Introducing WP Statistics – Professional website traffic counting plugin

This is a plugin that supports counting the number of views of articles (applicable to all types of articles) that has existed for a long time and has now been developed to version 8.7.2 with nearly 1 million downloads. I still use this plugin for some of my sales wordpress themes to count the views of each article, in addition to using Google Analytics and find it very stable and convenient.

Key features:

  • Display the number of users directly accessing the website.
  • Daily visit statistics.
  • Provide detailed information about users accessing the website.
  • Track each page separately to know which page is being viewed the most.
  • Visit statistics from search engines such as Google, Yahoo, Baidu, Bing, …
  • Track visits from different countries.
  • Support the option not to save IP addresses.
  • Visit country statistics based on the map.
  • Send full statistics via email.
  • Set viewing and management rights based on user groups in WordPress.
  • Option not to count views from users in specified groups.
  • Remove view counts from search bots.
  • Remove view counts based on IP address subnet.
  • Remove view counts in the admin Dashboard page.
  • View count statistics are removed.
  • Automatically update GeoIP database.
  • Automatically delete old data.
  • Export statistics to Excel, XML, CSV or TSV files.
  • Overview page with detailed statistics on views, countries, IP addresses, referral pages, online users, etc.
  • Support widgets to display website view statistics.
  • Support shortcodes and PHP functions to display view information of posts, pages or the entire website.
  • There is a detailed tracking table in Admin.
  • There is a Vietnamese version if you have installed Vietnamese language for WordPress.

Instructions for using WP Statistics

Once you install the WP Statistics plugin, your views will be recalculated from scratch. This means you will have a completely new set of statistics. You can access the Statistics menu in your Dashboard to manage and customize the plugin settings.

This is the admin and statistics viewing area of ​​WP Statistics.

When you activate the plugin, it will automatically calculate views for you. However, you can customize the settings by going to Statistics -> Settings.

In the settings section, you will see many different options. Here is what each tab means so you can understand better:

General: This is the overall settings of the plugin. You can enable or disable the main features of the plugin here.

Notifications: You can set up to receive email notifications about website statistics.

Dashboard/Overview: Customize how visit statistics are displayed on the admin page.

Access/Exclusions: Set access rights and remove unwanted views.

GeoIP: This feature can be used to count by country using GeoIP.

browscap: Adjust the browser database to detect browsers.

Maintenance: Set up to automatically delete old data.

Removal: If you want to remove the plugin, you can use this feature to delete related data in the database.

About: About the plugin.

When you go to your posts management (e.g. Posts -> All Posts), you will see a new column that shows the number of views for each post. This data will be updated continuously every time there are new views.

If you want to see more details, you can click on the number of views on each post or go to Statistics -> Overview to see the overall statistics of your website.

Displaying article views outside the website

Display statistics of the entire website using widget

WP Statistics provides you with a widget called Statistics that you can use in Appearance -> Widgets. In this widget, there are many options for you to display the statistics that you want.

If you have installed Vietnamese language for WordPress, the widget will be displayed as follows:

Don’t hesitate to click to see the statistics easily and professionally!

Show views in post content

By default, the WP Statistics plugin will not automatically display the number of views of a post when you visit the content due to caching issues. However, you can easily do this by using a shortcode or a PHP function supported in the plugin.

If you want to get the number of views of the current post, you can insert the following shortcode into the content:

[wpstatistics stat=pagevisits]

By default, this shortcode will display the total number of views. If you want to get the number of views by day, week or month, you can add the “time” parameter as the following example:

[wpstatistics stat=pagevisits time=week]

The “time” parameters can be:

today

yesterday

week

month

year

total

-x (for example, if you want to get statistics for the past 10 days, enter -10)

If you want to automatically display this shortcode on the entire post, you can use the function do_shortcode and insert it into the file single.php (template to display the content of the post).

If you want to use a PHP function to get the number of views of a current post, you can insert the following code into the file single.php:

ID), $post->ID); ?>

Where, “total” is the time parameter as above.

List of WP Statistics shortcodes

In addition to displaying the number of views of the post as introduced above, this plugin also provides many other shortcodes for you to use flexibly.

How to use the shortcode of WP Statistics is as follows:

[wpstatistics stat=xxx time=xxx provider=xxx]

In which,

stat – Select the type of data you want to display (see the list below)

time – Select the time period to retrieve data (same as in the previous section)

provider – If you want to see visit statistics from search engines, use this parameter (bing/duckduckgo/google/yahoo/yandex).

Values ​​for the stat parameter include:

StatDescriptionusersonlineNumber of users currently online on the website.visitsTotal number of website views.visitorsTotal number of website visitors.pagevisitsTotal number of views of the current post (may apply to other post types).searchesTotal number of visits from search engines.postcountTotal number of posts on the website.pagecountTotal number of pages on the website.commentcountTotal number of comments on the website.spamcountTotal number of spam comments.usercountTotal number of users on the website (including user accounts).postaverageAverage number of posts per user on the website.commentaverageAverage number of comments per user on the website.useraverageAverage number of users on the website.lpdLast date a post was made on the website.Example:

[wpstatistics stat=usersonline][wpstatistics stat=visitors time=today][wpstatistics stat=visits time=today][wpstatistics stat=visitors time=yesterday][wpstatistics stat=visits time=yesterday][wpstatistics stat=visitors time=total][wpstatistics stat=visits time=total]..

List of PHP functions of WP Statistics Plugin

PHP functions are similar to shortcodes, but the difference is that some functions have parameters and some do not. Below is a list of WP Statistics functions, which also clearly states the parameters if any.

FunctionDescription

wp_statistics_useronline() : Displays the number of people online.

wp_statistics_visitor(time) : Displays the total number of visits.

wp_statistics_visit(time) : Displays the total number of visits.

wp_statistics_pages(time,uri,id) : Displays the total number of visits to a specific page.

wp_statistics_uri_to_id(uri) : Gets the ID number of the current page (applies to post types).

wp_statistics_get_top_pages() : Gets a list of the most visited pages.

wp_statistics_get_uri() : Get the URL of the current page being viewed.

wp_statistics_searchengine(provider, time) : Displays the total number of visits from search engines.

wp_statistics_ua_list() : Gets the list of User Agents that have visited the website.

wp_statistics_useragent(agent) : Gets the number of visits by a specific User Agent.

wp_statistics_platform_list() : Gets the list of platforms used by visitors.

wp_statistics_platform(platform) : Displays the number of visits based on a specific platform.

wp_statistics_agent_version_list(agent) : Gets the list of User Agent versions.

wp_statistics_agent_version(agent, version) : Gets the total number of visits based on the User Agent version.

wp_statistics_searchengine_list(all) : Get the list of search engines that have accessed the website.

wp_statistics_searchword_query (search_engine) : Get the user’s search query from the specified search engine.

wp_statistics_searchengine_query (search_engine) : Returns the SQL query to search all results from the specified search engine.

wp_statistics_searchengine_regex (search_engine) : Returns the results in regex format of the pages accessed from the search engine.

wp_statistics_countposts() : Counts the number of posts on the website.

wp_statistics_countpages() : Counts the number of pages on the website.

wp_statistics_countcomment() : Counts the number of comments on the website.

wp_statistics_countspam() : Count the number of spam comments on the website.

wp_statistics_countusers() : Count the number of users on the website.

wp_statistics_lastpostdate() : The last date a post was posted.

wp_statistics_average_post() : Get the average number of posts on the website.

wp_statistics_average_comment() : Get the average number of comments on the website.

wp_statistics_average_registeruser() : Get the average number of users on the website.

All functions only get data, so to display it on the screen, you need to use the echo keyword.

Delete some WP Statistics data in database

If you use this plugin for a long time, it is very likely that the plugin’s visit data will accumulate in the database. Therefore, you should occasionally delete unnecessary data by going to Statistics -> Optimize -> Delete to clean the data. You can delete all data in a certain period or just delete certain types of data that you do not need.

Problems with cache plugins and host performance

As you know, this plugin will save the number of visits by adding a new query to the database. So, if you are using cache plugins and applying the HTML Cache method (saving cache content into .html file like popular cache plugins), then when a visitor to your website views the cache content, it will not be counted as a page view. This is because the cache content is just a static page and there is no query.

So, using this plugin can cause problems if you are using HTML Cache for your website. However, if you are using a dedicated server with other types of cache like Opcode Cache, Object Cache or Database Cache, the plugin still works well because it will send queries on every visit.

Due to the nature of the plugin, it will frequently write new data to the database, which can be resource-intensive on the host. So, make sure your host has a PHP Memory Limit of 64MB or more. If you have a large number of visitors or many pages, it is recommended to set the PHP Memory Limit to 128MB or higher to ensure better performance. However, this function is usually used for small or medium websites, while large websites usually do not use such self-management solutions because it can affect the performance of the website.

See also:

  • 10 common errors when using WordPress
  • Count website visits professionally with WP Statistics
  • Instructions on how to update WordPress manually without losing data, the safest
  • Instructions on how to localize WordPress themes and plugins with Loco Translate plugin
  • Instructions on how to install WordPress on localhost

Leave a Reply

Your email address will not be published. Required fields are marked *

About Us

📍 thon Doai

📞 0346386451

📧 tlongvu76202@gmail.com

Quick Links

Terms & Conditions

Privacy Policy

Ordering Guide

Delivery & Order Fulfillment

Return & Refund

Customer Support

Contact Us

About Us

FAQ

DCMA

Social

Facebook Zalo Twitter YouTube
Copyright 2025 © Last updated 2025