Track total, daily, weekly, and monthly views for entries, categories, tags, and custom routes. Fully supports multi-site setups, Blitz static caching, and works with Craft CMS 4 and 5.
✨ Features
- Track views of Entries, Categories, Tags, and custom routes
- Multi-site support
- View counting via AJAX/fetch for Blitz/static cache compatibility
- Compatible with Craft CMS 4 and 5
- Automatically detect bots and exclude them from the count.
🔢 Count Views
Manually trigger a view count for any supported element or custom URI:
{# Entry #}
{% do craft.storeView.count(entry.id) %}
{# Category #}
{% do craft.storeView.count(category.id) %}
{# Tag #}
{% do craft.storeView.count(tag.id) %}
{# Custom route (e.g., static page) #}
{% do craft.storeView.count(craft.app.request.getPathInfo()) %}
🔁 AJAX View Tracking (For Blitz/Static Cache Support)
Use the following code to send an AJAX request that registers a view:
{% js %}
fetch('/store-view/api/track-page-view' + window.location.search, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json',
'X-CSRF-Token': '{{ craft.app.request.csrfToken }}'
},
body: JSON.stringify({
elementId: {{ entry.id ?? 'null' }},
siteId: {{ currentSite.id ?? 'null' }},
uri: window.location.pathname
}),
});
{% endjs %}
🔍 Querying Store Views
Use craft.storeView.entries()
to retrieve and filter view statistics with a fluent API.
🔧 Basic Usage
{% set views = craft.storeView.entries().all() %}
🔍 Filter by Section
{% set blogViews = craft.storeView.entries().sections('blog').all() %}
Multiple sections:
{% set views = craft.storeView.entries().sections(['blog', 'news']).all() %}
🔍 Filter by Category Group
{% set views = craft.storeView.entries().categories('topics').all() %}
🔍 Filter by Tag Group
{% set views = craft.storeView.entries().tags('labels').all() %}
🕒 Filter by Date Range
{% set todayViews = craft.storeView.entries().withRange('today').all() %}
{% set thisWeekViews = craft.storeView.entries().withRange('thisWeek').all() %}
{% set thisMonthViews = craft.storeView.entries().withRange('thisMonth').all() %}
🛠 Custom Filters
{% set views = craft.storeView.entries()
.where({ elementId: 123 })
.limit(10)
.offset(5)
.orderBy('total DESC')
.all() %}
📄 Get One Record
{% set view = craft.storeView.entries().where({ elementId: 123 }).one() %}
🔢 Count Total
{% set count = craft.storeView.entries().sections('blog').count() %}
Standard
Plus $12/year after one year.
Installation Instructions
To install this plugin, copy the command above to your terminal.
Reviews
This plugin doesn't have any reviews.
Active Installs
1
License
Craft
Last release
June 8, 2025
Activity (30 days)
0
Closed Issues
0
Open Issues
0
Merged PRs
0
Open PRs