Shortcodes

WP Statistics supports shortcodes in WordPress, these can be used in either a post or a page body, as well as an HTML widget.

The general shortcode format is:

[wpstatistics stat=xxx time=xxxx provider=xxxx format=xxxxxx id=xxx]

Where:

Item

Description

stat

The statistics you want, see the next table for available options.

time

Is the time frame (time periods) for the statistic.  This value uses the strtotime() PHP function (http://php.net/manual/en/datetime.formats.php) format, some acceptable values include:

  • today 

  • yesterday 

  • week 

  • month 

  • year 

  • total  

  • “-x” (i.e., “-10” for the past 10 days) 

Please refer to the above-mentioned PHP manual link for a complete description.

provider

The search provider to get stats on (ask/bing/clearch/duckduckgo/google/yahoo/yandex).

format

The format  for numbers, the options are i18n (uses the format of the current country as set in WordPress), English (uses 1,000.00 style formats) or none (the default will return n number without any formatting)

Id

The page/post ID to get statistics on.  Only used on page visits.

 

The “stat” field can be any of the followings:

Stat

Description

usersonline

The number of users online right now.

visits

The number of hits to the site.

visitors

The number of visitors to the site.

pagevisits

The number of times the current page has been visited

searches

The number of search engine referrals.

postcount

The total number of posts on the site.

pagecount

The total number of pages on the site.

commentcount

The total number of comments on the site.

spamcount

The total number of spam comments on the site.

usercount

The total number of users on the site.

postaverage

The average posts per user on the site.

commentaverage

The average comments per user on the site.

useraverage

The average number of users on the site.

lpd

The last post date for the site.

 

Examples:

[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]

Features

WP Statistics has many features:

  • User Online, see how many people are currently viewing your site
  • Visits, see how many hits your site gets each day
  • Visitors, see who’s visiting your site
  • Page tracking, see which pages are viewed most often
  • Search Engines, see search queries and redirects from popular search engines like Google, Bing, DuckDuckGo, Yahoo, Yandex and Baidu
  • GeoIP location by Country
  • Support for not storing IP addresses in the database
  • Interactive map of visitors location
  • E-mail reports of statistics
  • Set access level for view and manage roles based on WordPress roles
  • Exclude user roles from statistics collection
  • Exclude robots from statistics collection
  • Exclude IP subnets from statistics collection
  • Exclude login/admin pages from statistics collection
  • Record statistics on exclusions
  • Automatic updates to the GeoIP database
  • Automatically prune the databases of old data
  • Export the data to XML, CSV or TSV files
  • Overview and detail pages for all kinds of data, including; browser versions, country stats, hits, exclusions, referrers, searches, search words and visitors
  • Widget to provide information to your users
  • Shortcodes for many different types of data in both widgets and posts/pages
  • Dashboard widgets for the admin area

Subscribe Newsletter

Sign up with your email address to receive news and updates.