Products Views & Advanced Reporting
Turn real product-view activity into credible social proof and smarter merchandising.
Why it works
Honest counting
Every view is logged individually with a visitor ID, customer ID, store, and timestamp. Choose unique per session counting or total views if you want raw page loads.
Credible badges
The storefront badge is fully governed by thresholds you set. A minimum views floor hides the badge entirely on products without meaningful traffic.
Merchandising impact
"Popularity" is added as a native sort option on category pages, so shoppers can browse by what everyone else is looking at.
Quiet automation
Popularity is recalculated nightly by cron (2 AM) with batched processing, chunked aggregation, and a distributed lock so overlapping runs can't collide.
Technical Reliability
Display Thresholds
A display threshold rounds large numbers into "1000+" instead of an oddly precise figure. A "HOT!" flag fires when a product crosses your heat threshold.
Admin Integrations
In the admin, popularity becomes a sortable, filterable column in the product grid and in the related/up-sell product listings.
Operational Reliability
Batched processing ensures that nightly aggregations won't crash your server under heavy load.
Headless Architecture
Fully compatible with headless storefronts. Retrieve product popularity scores and view metrics in real-time via our robust GraphQL and SOAP APIs, making it perfect for custom frontend experiences.
Everything included
Requirements
Make sure your environment meets these requirements before installing.
- Magento 2.4.x (Open Source or Commerce)
- PHP 8.1 or higher
- Composer 2.x
- Magento_Catalog, Magento_CatalogGraphQl, Magento_Customer, Magento_GraphQl, Magento_Store
Installation
composer require abam/module-product-viewsphp bin/magento module:enable Abam_ProductViewsphp bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento cache:flushConfiguration
| Setting | Path | Default | Description |
|---|---|---|---|
| Enabled | general/enabled | Yes | Master on/off switch. |
| Counting Method | general/counting_method | unique | unique — One view per visitor per session per day. total — Every page load counts. |
| Store Scope | general/store_scope | global | Whether view counts aggregate globally or per store view. |
| Display Scope | display/display_scope | month | Time frame for the badge text (today, week, month, lifetime). |
| Display Threshold | display/display_threshold | 1000 | Numbers above this are rounded (e.g. "1000+"). |
| Minimum Views | display/minimum_views | 10 | Badge is hidden until a product reaches this threshold. |
| Hot Threshold | display/hot_threshold | 100 | Views above this mark the product as "HOT!". |
| Sort Metric | popularity/sort_metric | month | Which time frame the native "Popularity" sort uses. |
| Decay Factor | popularity/decay_factor | 0.1 | Exponential decay coefficient — higher values favor recent activity more strongly. |
| Calculation Period | popularity/popularity_calculation_period | 90 days | How far back (in days) the popularity algorithm looks. |
| Log Retention | cleanup/log_retention_days | 90 days | View logs older than this are automatically purged by the nightly cleanup cron. |
GraphQL API
ProductInterface with a view_count field and adds a mutation for registering views asynchronously from headless frontends.Query — Product View Count
{
products(filter: { sku: { eq: "YOUR-SKU" } }) {
items {
name
view_count {
today
week
month
lifetime
formatted # "1000+ views this month"
display_value # "1000+"
is_hot # true / false
should_display # true if above minimum_views
}
}
}
}Mutation — Register a View
mutation {
registerProductView(productId: 42) {
success
message
view_count {
today
month
is_hot
}
}
}Tip: Call registerProductView asynchronously on PDP load (e.g. via requestIdleCallback) so it never blocks the rendering waterfall.
Cron Jobs
You can also trigger these manually via CLI:
php bin/magento abam:productviews:calculate-popularity
php bin/magento abam:productviews:cleanup-view-logsFeature Overview
Ready to install?
Get started in under 5 minutes with Composer.
composer require abam/module-product-viewsContact Sales
Scale your Magento 2 store with confidence.
Join leading e-commerce brands and merchants boosting performance, conversions, and sales with Abam extensions.
