WSH Views Counter
The free plugin counts views and stores them on your site. PRO adds the analytics screens: geo, referrers, real-time, charts and a CSV export. The free plugin does not need a license key.
Install, license and updates follow the same steps for every plugin. Those steps are on Getting started. The notes below are only for Views Counter.
Install
- Install and activate WSH Views Counter. Activation creates the tables. Existing view counts are kept when you update.
- Open a published post on the front of the site. The counter records that view, including on a cached page, because the count is sent after the page loads.
- For PRO, download the zip from My Account → Plugin files, upload it, and activate it. PRO requires the free plugin, version 1.3.32 or newer.
- Open Views Counter PRO in wp-admin and paste the license key.
Deactivating either plugin does not delete counts. Data is removed only if you turn on deletion in Settings and then uninstall the free plugin while PRO is not active.
License
The free plugin never asks for a key. PRO checks the key against wppluginspro.io.
- Plans are 1 site, 5 sites or 25 sites. A staging, localhost or
.localaddress does not use a slot. - A News suite key unlocks Views Counter PRO and the other News PRO plugins on that one domain. It does not unlock Ecommerce plugins.
- When the expiry date has passed, the PRO screens show a locked notice. Counts, referrers and history stay in the database.
- A new PRO zip is offered only while the license is active. Download it from Plugin files.
Plans and prices are on the Views Counter page.
First setup
Go to Views Counter → Settings.
- Count interval. How long before the same visitor counts again on the same post. The default is 1 hour. Choices run from 30 minutes to 1 day.
- Post types. Posts, pages, products and any other public type you enable. Drafts are never counted.
- Display. Show the count automatically before or after the content, with your own label. You can also place it yourself with the shortcode below.
- Skip visitors. Administrators, logged-in users, guests, selected roles, or a list of IP addresses. The IP is read to apply the rule and is not saved.
- Bots. When the bot filter is on, empty and known crawler user agents are ignored.
- Retention. Turn on deletion if you want old daily rows removed. Live hits older than two days, and sessions idle for 30 days, are removed either way. Lifetime totals on each post stay.
There is also an import from the Post Views Counter plugin. Run it once from the tools on the settings screen. It copies existing counts into this plugin’s table.
Reports and display
Views Counter → Reports lists totals by post, author and date. Filter by period, post type and report, then sort total, mobile, desktop and logged-in views.
The Posts list has a Views column. On the edit screen, the Views Counter box shows the stored total and lets an editor correct it.
The dashboard widget shows the selected month and the top posts for that month.
In a post or template, the free shortcode is:
[wsh_views]
Free and PRO
The free plugin is a complete counter. PRO is a separate plugin. It does not hide code behind a lock inside the free zip.
| Feature | Free | PRO |
|---|---|---|
| Count published views, including cached pages | Yes | Yes |
| Daily, mobile, desktop and logged-in totals | Yes | Yes |
| Reports, Views column, dashboard widget | Yes | Yes |
Shortcode [wsh_views] and automatic display |
Yes | Yes |
| Referrer, session and live-hit rows kept for later | Yes | Yes |
| Country and city lookup | No | While the license is active |
| Geo, referrer, real-time, charts, authors, taxonomies | No | While the license is active |
| WooCommerce product funnel | No | While the license is active and WooCommerce is on |
| Export | No | CSV |
| Popular and trending list | No | Shortcode, widget and block |
Country names are looked up only after a PRO license is active, so the first days before PRO have counts and referrers, not a country. After you activate PRO, new views can include a country. The visitor IP is still not stored.
PRO screens in wp-admin check the license on each page. A locked screen does not delete anything.
What is stored
- A view row: post, date, and whether it was mobile, desktop or a logged-in visitor.
- A session key in the browser’s
localStorage, so a repeat view inside the interval is not counted twice. - The referrer domain, such as
google.com, not the full URL with query strings. - A short-lived live-hit row for the real-time screen. Rows older than two days are deleted.
- The IP address is not written to the database. It is used only to apply the repeat-view limit, the IP exclusion list, and, when PRO is licensed, the country lookup.
If a view is missing
- The post is a draft, private, or a post type that is not enabled in Settings.
- The same visitor already counted inside the interval. Change the interval, or wait.
- The visit was from an administrator, a logged-in user, a guest, or a role you excluded.
- The bot filter is on and the browser sent an empty or known crawler user agent.
- The IP is on the exclusion list.
- PRO analytics show the locked notice. The license is missing, expired, or the free plugin is older than 1.3.32.
Developer notes
The free shortcode prints the stored total for the current post:
[wsh_views]
PRO registers a list of popular or trending posts. mode is popular or trending. days defaults to 7. limit is capped at 50.
[wsh_popular_posts mode="trending" post_type="post" days="7" limit="5"]
Two PHP helpers, available when PRO is active:
$ids = wsh_vc_pro_get_trending_posts(array(
'post_type' => 'post',
'days' => 7,
'limit' => 5,
));
$stats = wsh_vc_pro_get_post_stats(get_the_ID(), 30);
$total = $stats['total'];
$daily = $stats['daily'];
The free plugin also has wsh_views_counter_get_posts() for a most-viewed list of post IDs.
REST API
Base path: /wp-json/wsh-views/v1/
GET /post/{id}?days=30returns the total and daily counts.daysis limited to 366.GET /top-posts?post_type=post&days=7&limit=10&mode=trendingreturns id, title and link.modeispopularortrending.limitis limited to 50.
Both routes require a logged-in user who can edit posts, an active PRO license, and permission to read that post. A private post is not returned to someone who cannot open it.
To send a viral alert to your own URL, return it from the wsh_vc_pro_webhook_endpoints filter. The plugin POSTs JSON with the post ID, title, link and score. No endpoint is called until you add one.
Recent changes
Free plugin 1.3.34 was tested on WordPress 7.1. Repeat views use the visitor’s real address. A forwarded header is trusted only when the request comes from a private proxy. Logged-in, guest and role exclusions are applied. Live hits older than two days and sessions idle for 30 days are removed.