This is what our generic shortcode looks like:

[slimstat f='count|count-all|recent|recent-all|top|top-all|widget' w='dimension|widget_id' s=' ' o='1']optional filters[/slimstat]


  • f : criteria to be used (count results, get top or recent items, widget to display) - this parameter is required
  • w : dimension or ID of the widget to display - this parameter is required
  • s : separator for lists of elements - this paramenter is optional, default: empty
  • o : offset for counters - this parameter is optional

Let's say, for example, that we want to count how many page views have been tracked for a post with permalink containing the string "welcome". Here below are step-by-step instructions on how to build the corresponding shortcode.

The w attribute in our shortcode allows you specify what dimension or metric you would like to use. Let's say you want to COUNT something: that's what the w attribute allows you to do. It qualifies that something: count IP addresses, count users, count search terms, etc. If you would like to count page views, then the dimension you want to use is "id" : w='id'.

So far we have

[slimstat f='count' w='id'] ... [/slimstat]

Now, the content in BETWEEN the opening shortcode tag and the closing tag determines your condition:

[slimstat f='count' w='id'] ONLY RECORDS THAT SATISFY THIS CONDITION [/slimstat]

You can use almost any of the dimensions (see below) plus other special keywords to build your condition. Our condition is: count all the page views where the permalink contains the string "8242". This is how you write the condition:

post_link contains 8242

So putting it all together:

[slimstat f='count' w='id']post_link contains 8242[/slimstat]

Here below is a detailed list of criteria and dimensions you can use.

  • count: number of pageviews matching your filters, during the current month
  • count-all: number of all-time pageviews matching your filters
  • recent: twenty most recent distinct items (metric parameter) matching your filters
  • recent-all: same as above, but not using the current month as a date range
  • top: top distinct items (metric parameter) matching your filters
  • top-all: same as above, but not using the current month as a date range
  • widget: introduced in Slimstat 4.6, it allows you to display one of the reports on your website; if you use this criteria, the w attribute will need to contain the ID of the widget you want to display. Hovering the widget titles in the admin will reveal the corresponding ID to be used in your shortcode

  • ip: IP address of the visitor
  • username: visitor's name according to the cookie set by Wordpress after s/he left a comment
  • country: 2-letter code (us, ru, de, it, ...)
  • referer: complete URL of the referring page
  • post_link: linked path of the page accessed on your website
  • post_link_no_qs: as above, but ignoring any query string appended to the permalink
  • searchterms: search term used to find your website on a search engine
  • notes: custom information associated to a specific pageview (cookies, user_id, etc0Z
  • browser: user agent (Firefox, Chrome, ...)
  • platform: win7, macos, linux, etc
  • language: please refer to the first column on this table for more information
  • resolution: screen resolution (i.e.: 1920x708)
  • content_type: post, page, custom-post-type, attachment, singular, post_type_archive, tag, taxonomy, category, date, author, archive, search, feed, home, download
  • content_id: unique post id
  • outbound_resource: external link clicked to leave your website

You can use a pseudo-natural language to define your filters for the shortcode. They use the following format: metric operator value. The following operators are available:
  • equals

  • is_not_equal_to
  • contains
  • does_not_contain
  • starts_with
  • ends_with
  • sounds_like
  • is_greater_than
  • is_less_than
  • between, followed by two values in parentheses separated by comma: between (6,10)
  • matches, which uses the REGEXP MySQL operator (follow the link to learn more about it)
  • does_not_match, which uses the NO REGEXP operator
  • is_empty, followed by a blank space and the # sign: searchterms is_empty #&&&month equals 5
  • is_not_empty

You can combine multiple filters (as a "boolean AND" expression) by using the &&& operator:

searchterms contains pasta&&&month equals 5

You can use the matches filter if you need to compose a "boolean OR" expression:

searchterms matches hello|world

Special Filters

In addition to all the existing metrics, you can use the following special keywords in filters:
  • limit_results: how many items to display at max
  • starting: offset for the resultset
  • resource: permalink of the page accessed on your site - please use this keyword instead of post_link, when filtering by resource
  • day
  • month
  • year
  • interval
  • interval_direction
  • strtotime