Abam
Magento 2 Extension

Products Views & Advanced Reporting

Turn real product-view activity into credible social proof and smarter merchandising.

Magento 2.4.xPHP 8.1+GraphQL APIHeadless ReadyHyvä CompatibleScandiPWA CompatibleLuma Compatible
View Documentation & Install
Storefront Preview
419 people viewed this this month
HOT!Trending product in your catalog
Admin Control
Sort ByPopularity (Views) ▼
Admin GridFilter: Views > 400

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

Real visitor behavior tracking
Unique per-session or total view counting
Minimum view thresholds and rounding
Native 'Popularity' sort on category pages
Admin grid and up-sell sorting
Nightly cron batch processing
Full GraphQL layer

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

Install via Composer. The module registers two cron jobs automatically — no extra setup needed beyond the standard Magento cron runner.
1Require the package
composer require abam/module-product-views
2Enable the module
php bin/magento module:enable Abam_ProductViews
3Run setup & compile
php bin/magento setup:upgrade php bin/magento setup:di:compile php bin/magento cache:flush

Configuration

All settings live under Stores → Configuration → Abam → Product Views.
SettingPathDefaultDescription
Enabledgeneral/enabledYesMaster on/off switch.
Counting Methodgeneral/counting_methoduniqueunique — One view per visitor per session per day. total — Every page load counts.
Store Scopegeneral/store_scopeglobalWhether view counts aggregate globally or per store view.
Display Scopedisplay/display_scopemonthTime frame for the badge text (today, week, month, lifetime).
Display Thresholddisplay/display_threshold1000Numbers above this are rounded (e.g. "1000+").
Minimum Viewsdisplay/minimum_views10Badge is hidden until a product reaches this threshold.
Hot Thresholddisplay/hot_threshold100Views above this mark the product as "HOT!".
Sort Metricpopularity/sort_metricmonthWhich time frame the native "Popularity" sort uses.
Decay Factorpopularity/decay_factor0.1Exponential decay coefficient — higher values favor recent activity more strongly.
Calculation Periodpopularity/popularity_calculation_period90 daysHow far back (in days) the popularity algorithm looks.
Log Retentioncleanup/log_retention_days90 daysView logs older than this are automatically purged by the nightly cleanup cron.

GraphQL API

The module extends the core ProductInterface with a view_count field and adds a mutation for registering views asynchronously from headless frontends.

Query — Product View Count

GraphQL Query
{
  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

GraphQL Mutation
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

Two cron jobs run nightly. Both use batched processing with chunked aggregation and a distributed lock to prevent overlapping runs.
Calculate Popularity0 2 * * * (daily at 2:00 AM)
Cleanup Old View Logs0 3 * * * (daily at 3:00 AM)

You can also trigger these manually via CLI:

php bin/magento abam:productviews:calculate-popularity php bin/magento abam:productviews:cleanup-view-logs

Feature Overview

Everything included out of the box.
Real visitor behavior tracking with timestamps
Unique per-session or total view counting
Configurable minimum-view thresholds
Automatic number rounding (e.g. "1000+")
"HOT!" badge for trending products
Native "Popularity" sort on category pages
Admin grid column — sort & filter by views
Time-weighted popularity scoring with decay
Full GraphQL API (query + mutation)
Nightly cron batch processing
Automatic log cleanup & retention
Hyvä & Luma frontend compatibility

Ready to install?

Get started in under 5 minutes with Composer.

composer require abam/module-product-views

Contact Sales

Scale your Magento 2 store with confidence.

Join leading e-commerce brands and merchants boosting performance, conversions, and sales with Abam extensions.