CodeFaeries Views Metrics

Description

CodeFaeries Views Metrics provides comprehensive view tracking for any post type including posts, pages, WooCommerce products, and custom post types. Built with clean, modern code architecture and extensive customization options.

Works with or without WooCommerce – This plugin is fully functional for any WordPress site, whether you use WooCommerce or not. WooCommerce integration is completely optional and provides bonus features when available.

Key Features

  • Universal Tracking – Works with posts, pages, WooCommerce products, and any custom post type
  • Dashboard Widget – At-a-glance statistics with interactive chart on WordPress dashboard
  • Gutenberg Blocks – Post Views and Most Viewed Posts blocks for the block editor
  • Most Viewed Posts Widget – Sidebar widget to display popular content
  • Smart Exclusions – Exclude crawlers, AI bots, logged-in users, guests, specific roles, categories, or individual posts
  • Flexible Display – Show counters before content, after content, or manually via shortcode with customizable text
  • Role-Based Visibility – Control which user roles can see view counters
  • Role-Based Counting – Exclude specific roles from being counted (admins and shop managers by default)
  • Performance Optimized – Multiple tracking methods including Fast AJAX for cached sites
  • WooCommerce Integration – Sort products by most viewed on shop pages
  • Quick/Bulk Edit – Manually adjust view counts directly from admin lists
  • Import Tool – Migrate view data from WP-PostViews or other plugins
  • GDPR Compliant – IP anonymization options and privacy policy snippet
  • Developer Friendly – Clean, well-documented code with filters and hooks
  • Admin Integration – View counts in post/product listing pages with sorting
  • Real-Time Statistics – Dashboard showing total, today, yesterday, weekly, and monthly views

Third-Party Libraries

This plugin uses the following third-party libraries:

Chart.js

  • License: MIT License — https://opensource.org/licenses/MIT
  • Source: https://github.com/chartjs/Chart.js
  • Version: 4.5.0
  • Usage: renders interactive charts in the admin dashboard widget and the post-list column chart modal.

Blocks

This plugin provides 2 blocks.

  • Post Views Display the view count for the current post. Part of Views Metrics plugin – track and display post views with detailed analytics.
  • Most Viewed Posts Display a list of the most viewed posts with customizable period filters. Part of Views Metrics plugin for comprehensive view tracking.

Installation

  1. Upload the codefaeries-views-metrics folder to the /wp-content/plugins/ directory, or install directly through the WordPress plugin screen.
  2. Activate the plugin through the ‘Plugins’ menu in WordPress.
  3. Navigate to Views Metrics in the WordPress admin menu.
  4. Configure your tracking and display settings.

Configuration

  • Post types – Select which post types to track (posts, pages, products, etc.)
  • Tracking method – PHP (Standard), JavaScript (AJAX), REST API, or Fast AJAX (recommended for cached sites)
  • Unique visit throttle – Prevent counting duplicate views from the same user within a time period
  • Counter position – Before/after content or manual via [cfvm_views_counter] shortcode
  • Exclusions – Exclude crawlers, AI bots, specific roles, categories, posts, or IP addresses

FAQ

Does this plugin require WooCommerce?

No. Views Metrics works with any WordPress site. WooCommerce is completely optional. When WooCommerce is installed, you get bonus features like product view tracking and a “Sort by most viewed” option on the shop page.

Which tracking method should I use?

If your site uses a caching plugin (WP Rocket, W3 Total Cache, LiteSpeed Cache, etc.), choose Fast AJAX. It records views asynchronously and works correctly even when pages are served from cache. For sites without caching, PHP (Standard) is the simplest option.

How does the unique visit throttle work?

The throttle prevents the same visitor from inflating view counts. When set to e.g. 1 hour, a second page view from the same user within that hour is not counted. Set to 0 to count every page view.

Is the plugin GDPR compliant?

Yes. You can choose how IP addresses are stored: full (best duplicate detection), anonymized (last octet removed), or disabled (no IP storage at all). A ready-to-use privacy policy snippet is provided under Advanced settings.

Can I exclude bots and crawlers from view counts?

Yes. By default, crawlers (Googlebot, Bingbot, etc.) and AI bots (GPTBot, ClaudeBot, Google Extended, etc.) are excluded. You can also exclude logged-in users, guests, specific roles, categories, posts, and IP addresses.

Can I import views from another plugin?

Yes. Go to Views Metrics > Advanced and use the Import tool. It supports WP-PostViews (views meta key), Post Views Counter (post_views_count), or any custom meta key. Preview the import before running it.

How do I display the view counter manually?

Use the [cfvm_views_counter] shortcode. It supports attributes for period (today, week, month, total), custom text with a {count} placeholder, and more. Two Gutenberg blocks are also available: Post Views and Most Viewed Posts.

Does it work on multisite?

Yes. Views Metrics supports multisite with network-wide activation. Tables are created for each site automatically, including newly created sites.

Reviews

There are no reviews for this plugin.

Contributors & Developers

“CodeFaeries Views Metrics” is open source software. The following people have contributed to this plugin.

Contributors

Changelog

1.0.2 – 2026-05-11

  • Compatibility: minimum PHP requirement lowered to 7.3 — the plugin now runs on a wider range of hosts.
  • Code quality: additional WordPress Plugin Check findings resolved.
  • Changed: shortcode renamed from [cf-views] to [cfvm_views_counter].

1.0.1

  • Fixed: stability fixes at plugin startup — internal services now initialize reliably alongside the shared toolkit.
  • Fixed: cleanup cron now scheduled correctly on activation; admin bar caches invalidated when needed.
  • Fixed: Fast AJAX bootstrap and multisite hooks hardened; admin code cleanup.

1.0.0

  • Code quality: passes WordPress Plugin Check and PHPCS WordPress Coding Standards cleanly.
  • Improved: input sanitization and output escaping reviewed across the codebase.
  • Improved: error logging now gated behind WP_DEBUG (no log noise in production).

0.0.3

  • New: Dashboard widget with an interactive chart and statistics.
  • New: Gutenberg blocks “Post Views” and “Most Viewed Posts”.
  • New: “Most Viewed Posts” sidebar widget.
  • New: Quick Edit and Bulk Edit support for view counts.
  • New: import tool for migrating from WP-PostViews and similar plugins.
  • New: IP anonymization modes (full, anonymized, disabled) and a privacy-policy snippet generator.
  • New: sortable Views column in admin post lists.
  • Improved: admin UI with modern pill-style tabs.

0.0.2

  • Changed: shortcode renamed from [post-views] to [cf-views].
  • New: shortcode attributes — period, text, hide_zero, class.
  • New: “Exclude roles from count” setting.
  • New: WooCommerce “Most viewed” sort option.
  • Improved: default exclusions now cover crawlers, AI bots, administrators, and shop managers.
  • Improved: counter hides automatically when count is zero.
  • Fixed: Fast AJAX tracking mode.

0.0.1

First release. Tracks views across post types with bot detection, role-based visibility, shortcodes, a statistics dashboard, and WooCommerce integration.