PHPackages                             update-switzerland/updmostviewed - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. update-switzerland/updmostviewed

ActiveProcesswire-module

update-switzerland/updmostviewed
================================

v2.0.4(1y ago)12MITPHP

Since Jun 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/update-switzerland/UpdMostViewed)[ Packagist](https://packagist.org/packages/update-switzerland/updmostviewed)[ RSS](/packages/update-switzerland-updmostviewed/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (3)Used By (0)

UpdMostViewed ProcessWire Module
================================

[](#updmostviewed-processwire-module)

Track Page Views and List «Most Viewed» Pages
---------------------------------------------

[](#track-page-views-and-list-most-viewed-pages)

The UpdMostViewed module for ProcessWire enables you to track page views and return a list of the most viewed pages within a given time range.
This module is ideal for creating sidebar-widgets, for example, a "Most Read Articles of the Week" display.

Getting Started
---------------

[](#getting-started)

Installing the UpdMostViewed module to your ProcessWire project is simple, choose one of the following methods:

- **Modules Directory:** Head into your ProcessWire backend, go to Modules &gt; New and search for the Module **UpdMostViewed**.
- **From GitHub:** Download the module directly from [Latest Releases on GitHub](https://github.com/update-switzerland/UpdMostViewed/releases/latest).
- **Using Composer:** If you're using Composer for your project, you can add the module by running the command `composer require update-switzerland/updmostviewed` in your project root directory.

With the module downloaded and installed, configure it to best suit your needs. Toggle on the "Automated Page View Counting" for hands-free tracking.

Usage
-----

[](#usage)

### Manual View Tracking

[](#manual-view-tracking)

While automatic tracking is recommended and easier to use, you can also manually track page views by adding the following line to your page templates

```
$modules->get('UpdMostViewed')->writePageView($page);
```

In this case, $page should be a ProcessWire Page object.
Manual view counting will still respect any settings for exclusions (IPs, crawlers, etc.).

---

### Automatic View Tracking (Recommended)

[](#automatic-view-tracking-recommended)

To use automatic tracking, simply go to the MostViewed module configuration and enable "Automated Page View Counting".

### Module Configuration

[](#module-configuration)

The MostViewed module provides numerous configuration options:

- Exclude certain branches (page ids and all their children)
- Exclude specific pages
- Exclude certain IPs
- Restrict counting to specific templates
- Define which user roles to count
- Choose to ignore views from search engine crawlers

Additionally, you can define multiple time ranges. If the module does not find enough views in the first time range, it will consider the second, and so on.
Default values for the time ranges are 1 day, 2 days, and 3 days.

### Retrieving the «Most Viewed» Pages

[](#retrieving-the-most-viewed-pages)

You can retrieve an array of the most viewed pages with the following code:

```
$mostViewed = $modules->get('UpdMostViewed')->getMostViewedPages();
```

This function can also take an array of options as a parameter to fine-tune the search for the most viewed pages.

```
$options = [
  'templates' => 'basic-page,news-entry', // Restrict search to specific templates (comma separated)
  'limit' => 5, // Limit the number of pages returned
  'viewRange' => 1440 // Set a custom view-range in minutes
];
$mostViewed = $modules->get('UpdMostViewed')->getMostViewedPages($options);
```

Once you have retrieved the most viewed pages, you can output them with a foreach loop:

```
echo "";
foreach ($mostViewed as $key => $most) {
  echo "{$most->title}";
}
echo "";
```

### Displaying the «Most Viewed» Pages with AJAX

[](#displaying-the-most-viewed-pages-with-ajax)

If your site uses cached pages, you might find that your list of "Most Viewed" pages falls out of date quickly. To keep your list current, consider using AJAX to retrieve real-time view data. You can do this by requesting the URL /?getMostViewedContent with optional argument.
Here is a jQuery example of AJAX integration for this module, showing how to limit results and provide a custom view range.

```

  Most viewed (Ajax load)
  Loading...

// load most viewed pages into page
$(document).ready(function() {
  const url = `?lang=&templates=basic-page,news-page&limit=4&viewRange=1440`;
  $.ajax(
    `/${url}`,
    {
      success: function(data) {
        $('#most-viewed-container .most-viewed-list').html(data);
      },
      error: function() {
        $('#most-viewed-container .most-viewed-list').html('Sorry, currently no data available');
      }
    }
  );
});

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

2

Last Release

695d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/c73841eb936c89270dde70f32efc53b5bdba0a3356d2c63aecc570a16c3eb419?d=identicon)[update-switzerland](/maintainers/update-switzerland)

---

Top Contributors

[![maersux](https://avatars.githubusercontent.com/u/32292938?v=4)](https://github.com/maersux "maersux (5 commits)")[![Nukro](https://avatars.githubusercontent.com/u/12048067?v=4)](https://github.com/Nukro "Nukro (4 commits)")

### Embed Badge

![Health badge](/badges/update-switzerland-updmostviewed/health.svg)

```
[![Health](https://phpackages.com/badges/update-switzerland-updmostviewed/health.svg)](https://phpackages.com/packages/update-switzerland-updmostviewed)
```

###  Alternatives

[elgg/elgg

Elgg is an award-winning social networking engine, delivering the building blocks that enable businesses, schools, universities and associations to create their own fully-featured social networks and applications.

1.7k15.7k5](/packages/elgg-elgg)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[johnbillion/user-switching

Instant switching between user accounts in WordPress and WooCommerce.

19768.3k2](/packages/johnbillion-user-switching)[rainlab/blog-plugin

Blog plugin for October CMS

17257.7k](/packages/rainlab-blog-plugin)[rainlab/user-plugin

User plugin for October CMS

11954.3k13](/packages/rainlab-user-plugin)[starcitizentools/citizen-skin

A beautiful, usable, responsive MediaWiki skin with in-depth extension support. Originally developed for the Star Citizen Wiki.

3164.5k](/packages/starcitizentools-citizen-skin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
