A fast, minimalist view counter for WordPress – REST-first and developer-friendly
Init View Count tracks post views using JavaScript + REST API for precision and flexibility. It includes shortcodes, tabbed rankings, template overrides, and works with any post type.
No jQuery. No cookies. No fluff.
Features at a Glance
Lightweight and Accurate
- Tracks views via REST API + scroll + delay logic
- Prevents duplicates with session/localStorage
- Optional batch mode: queue views and send in groups
- Optional strict IP-based filtering (no raw IP storage)
Flexible Shortcodes
-
[init_view_count]– show current post view count -
[init_view_list]– show list of most viewed posts -
[init_view_ranking]– tabbed ranking by day/week/month/total - Fully theme-overridable templates (
your-theme/init-view-count/*.php) - Format options: raw, formatted, short number, schema.org support
Clean Admin Tools
- Dashboard widget to show top viewed posts
- Settings panel to enable post types, batch, delay, scroll, etc.
- Shortcode builders for all views with live preview
Minimal Overhead
- No assets loaded unless shortcode used
- CSS can be disabled completely
- No tracking, no analytics bloat
Built for Developers
- Custom meta key support via filters
- Exposed REST API endpoints for tracking + top posts
- Fully filterable output and query logic
- Compatible with headless setups and SPAs
REST API Endpoints
POST /wp-json/initvico/v1/count
Record one or more post views.
Parameters:
-
post_id(int|array): One or more post IDs
GET /wp-json/initvico/v1/top
Retrieve top posts by views.
Parameters include:
-
range:total,day,week,month,trending -
number: Number of posts -
post_type,category,tag, etc. -
fields:minimalorfull -
no_cache: Disable transient caching
Shortcode Examples
| Shortcode | Description |
|---|---|
[init_view_count] |
Show view count for current post |
[init_view_list] |
Most viewed posts list |
[init_view_ranking] |
Tabbed list by day/week/month/total |
Add template, range, icon, schema, class, field, and other options as needed.
Dev Tools You Get
- Filters like
init_plugin_suite_view_count_should_count,*_meta_key,*_top_args - Modify output of
/topAPI withinit_plugin_suite_view_count_api_top_item - Theme override with
view-list-sidebar.php,view-list-grid.php, etc. - Zero jQuery. Zero cookies. Fully modular JS.
Installation
Install via WordPress.org or:
git clone https://github.com/brokensmile2103/init-view-count.git
Then activate and configure in Settings → Init View Count.
Ways to show views:
- Add
[init_view_count]in post content - Use auto-insert (before/after post content)
- Place view lists with
[init_view_list] - Show trending or ranked tabs with
[init_view_ranking]
Part of the Init Plugin Suite
Init View Count is part of the Init Plugin Suite – a set of minimalist, performance-first tools for WordPress developers.
Thanks for reading. Got feedback or ideas?
→ Project Page
→ GitHub
Top comments (0)