Adds support for shortcodes to WP SlimStat
A shortcode is sort of a placeholder: a special string that will be replaced by dynamic content.
[slimstat f='FUNC' w='WHAT_COLUMN' lf='FILTERS' lc='COLUMNS' s='SEP']
where
f [required] is the criteria to be used (count results, get popular or recent items)w [required] defines what dataset you want to retrieve (browser, language, resource; here below you can find a complete list of columns)lf [optional] specifies what conditions to use while retrieving the data (browser equals Firefox, country equals China); if the value starts with WHERE:, the string that follows will be used verbatim in the SQL querylc [optional, default: WHAT_COLUMN] tells the plugin what data to return; use * for all the columns (defaults to the column specified in w)s [optional] sets the character or string used to "separate" each piece of information in a row (defaults to <span class='slimstat-item-separator'>,</span>)[slimstat f='count-all' w='*'][slimstat f='popular' w='resource' lf='content_type equals post' lc='post_link,count'][slimstat f='recent' w='searchterms'][slimstat f='popular' w='searchterms' lf='day equals 1|month equals 1|interval equals -1'][slimstat f='popular' w='user' lc='user,count']count and count-all return a numberrecent and popular return a bulleted list of elementscustom, used along with filterby to run a custom SQL query - i.e. filterby='SELECT * FROM wp_slim_stats t1...'; it returns a list of elementsbrowser: user agent (Firefox, Chrome, ...)content_type: post, page, custom-post-type, attachment, singular, post_type_archive, tag, taxonomy, category, date, author, archive, search, feed, home; please refer to the Conditional Tags manual page for more informationcountry: 2-letter code (us, ru, de, it, ...)domain: domain name of the referring page (i.e., http://www.google.com if a visitor came from Google)language: please refer to the language culture names (first column) for more informationplatform: operating system; it accepts identifiers like win7, win98, macosx, ...; please refer to this manual page for more information about these codesreferer: complete URL of the referring pagesearchterms: search term used to find your website on a search engineuser: visitor's name according to the cookie set by WordPress after s/he left a commentA filter consists of three elements: the key, the condition and the value. For example, if you want to display your 20 most popular posts visited by people coming from Italy,
your key is country, your condition is equals and your value is it (Country code for Italy). You can combine multiple keys/values to further narrow down your results.
author: WordPress author associated to that post/page when the resource was accessedbrowser: user agent (Firefox, Chrome, ...)version: user agent version (9.0, 11, ...)category: ID of the category/term associated to the resource, when availablecss_version: what CSS standard was supported by that browser (1, 2, 3 and other integer values)colordepth: visitor's screen's color depth (8, 16, 24, ...)ip: visitor's public IP addressother_ip: visitor's private IP address, if availableresolution: viewport width and height (1024x768, 800x600, ...)resource: URL accessed on your sitetype: (browser) 1 = search engine crawler, 2 = mobile device, 3 = syndication reader, 0 = all othersdirection: asc or desc (lowercase)limit_results: max number of results returnedstarting: return results starting from a given offsetYes you can! By default shortcodes return data related to the current month, but you can specify a different start date and the interval in your filters (along with the equals operator):
day (default: 1)month (default: current month)year (default: current year)strtotime, use it if you want the plugin to use PHP's strtotime function to calculate a specific date for you (yesteday, this month, last year, 3 weeks ago)interval, to fix the number of days from the start date (for example, ten days starting from January 14th); please make sure to define interval after the start date!
day or strtotime are set, the default value is zeroday nor strtotime are set, the default value is the number of days in the current month-1 to indicate the number of days between the start date and today (in other words, to describe date ranges like 'Year to date', you can set day equals 1,month equals 1,interval equals -1)equalsis_not_equal_tocontainsdoes_not_containstarts_withends_withsounds_likeis_greater_thanis_less_thanis_empty (followed by a blank space and the # sign: searchterms is_empty #|month equals 5)is_not_empty (followed by a blank space and the # sign: searchterms is_not_empty #|browser contains fire)In order to simplify things, WP SlimStat Shortcodes implements a 'natural language' approach: define filters combining the various parameters, separating groups with the 'pipe' ( | ) character. For example, let's say you want to obtain your blog's 5 most popular posts. This is what the shortcode will look like:
[slimstat f='popular' w='resource' lf='content_type equals post|limit_results equals 5' lc='post_link,count']
Curious about what your visitors where searching for, before landing on your blog?
[slimstat f='recent' w='searchterms']
Do you want to target a specific language? What about listing the 20 most recent Chinese-speaking IP addresses who accessed just your homepage:
[slimstat f='recent' w='ip' lf='content_type equals home|language equals zh-cn|limit_results equals 20']
Do you need just to count how many pageviews have been generated during the current month? (by default all shortcodes use the current month as date range)
[slimstat f='count' w='*']
Maybe this year?
[slimstat f='count' w='*' lf='strtotime equals 1 January|interval equals -1']
The first 5 days of January?
[slimstat f='count' w='*' lf='day equals 1|month equals 1|interval equals 5']
From the beginning (all pageviews recorded so far)
[slimstat f='count-all' w='*']
Unique IPs (unique visitors):
[slimstat f='count' w='ip']
Unique Visits this month:
[slimstat f='count' w='visit_id']
Things can easily get fancy
[slimstat f='popular' w='searchterms' lf='searchterms contains pizza dough' lc='searchterms,count']count, available only when using popular, represents the number of pageviews matching your querydt, combined with recent, can be used to display date and time of each pageview (it uses your WordPress settings for date and time format)hostname, to convert IP addresses into hostnames, using PHP's gethostbyaddrpost_link, returns post titles linked to their corresponding permalinks
Requires: 3.1 or higher
Compatible up to: 3.5.1
Last Updated: 2013-1-17
Downloads: 16,912
2 of 3 support threads in the last two months have been resolved.
Got something to say? Need help?