Back to Shortcodes

Updated on Nov 13, 2023

Mastering WP Slimstat Shortcodes

WP Slimstat shortcodes allow you to track and display various statistics on your WordPress site. Whether you’re a beginner or an advanced user, understanding these shortcodes can help you effectively monitor your site’s performance.

Structure of WP Slimstat Shortcodes

A generic WP Slimstat shortcode looks like this:

[slimstat f='criteria' w='dimension|widget_id' s='separator' o='offset']condition[/slimstat]
  • f: The function you want to perform (e.g., count, top items, widget display).
  • w: Specifies the data dimension or widget ID.
  • s: Separator for lists (optional, default is empty).
  • o: Offset for counters (optional).

Creating a Shortcode: Step-by-Step

Example: Counting page views of a post with “welcome” in the permalink.

  1. Function (f): Choose count for counting page views.
  2. Dimension (w): Select id for page views.
  3. Condition: Write your condition between the shortcode tags. For our example: post_link contains welcome.

Complete Shortcode:

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

Criteria and Dimensions Detailed

Criteria:

  • count: Current month’s pageview count.
  • count-all: All-time pageview count.
  • recent: Twenty most recent items matching filters.
  • recent-all: Recent items not limited to current month.
  • top: Top distinct items matching filters.
  • top-all: Top items, not limited to current month.
  • widget: Display a report; use widget ID in w attribute.

Dimensions:

  • ip: IP address of the visitor.
  • username: Visitor’s name (after commenting).
  • country: Visitor’s country (2-letter code).
  • referer: URL of the referring page.
  • post_link: Linked path of the accessed page.
  • post_link_no_qs: Above, minus query string.
  • searchterms: Search term used on a search engine.
  • notes: Custom info associated with a pageview.
  • browser: Visitor’s browser type.
  • platform: Visitor’s operating system (e.g., win7, macos).
  • language: Visitor’s language (refer to specific table).
  • resolution: Screen resolution (e.g., 1920×1080).
  • content_type: Type of content (e.g., post, page).
  • content_id: Unique post ID.
  • outbound_resource: External link clicked.

Operators for Filters:

  • equals, is_not_equal_to
  • contains, does_not_contain
  • starts_with, ends_with
  • sounds_like
  • is_greater_than, is_less_than
  • between: Use with two values (e.g., between (6,10)).
  • matches: For REGEXP operations.
  • does_not_match: For NO REGEXP operations.
  • is_empty, is_not_empty
  • Combine filters with &&& for AND expressions.
  • Use matches for OR expressions.

Special Filters:

  • limit_results: Max items to display.
  • starting: Offset for result set.
  • resource: Filter by page accessed (use instead of post_link).
  • day, month, year
  • interval, interval_direction
  • strtotime: For time-based conditions.