Jump to content

Module: Most Viewed Pages Tracker (UpdMostViewed)


Recommended Posts

Hi everyone,

We have a new module for you: the UpdMostViewed module. It's an addition to your ProcessWire site that enables you to track page views and deliver a list of your most visited pages within a given time range. This data is particularly useful for creating frontend features like a "Most Read Articles of the Week" widget.

 

Installation
You can choose to:

  1. Head into your ProcessWire backend, go to Modules > New and search for the Module UpdMostViewed.
  2. Get the module directly from the latest releases on our GitHub repository.
  3. 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.

Once downloaded, you can install the module via the ProcessWire admin.

 

Configuration
The UpdMostViewed module provides you with a variety of configuration options. You can exclude certain branches, specific pages, certain IPs, restrict counting to specific templates, define which user roles to count, ignore views from search engine crawlers, and more.

Moreover, you can also customize the time ranges for the "most viewed" data.

 

Links
For more detailed information on usage, updates, or to download the module, please visit our GitHub repository and check out the module in the Module Directory.

 

UpdMostViewedConfig.thumb.png.bb9340ac7f08d25430c5652d2631f90d.png

  • Like 9
Link to comment
Share on other sites

This is really great! I want to be able to shift some priority in featured content around websites based on visibility/exposure to visitors, like "featured pages" or blog posts and this info will help provide the information needed to build that more robustly. I've tinkered in the past with $page->meta() but this looks very robust. Thank you for putting this together!

Link to comment
Share on other sites

So... I just installed it on a quite crowded site. Is there a way to see in the backend when there is enough data collected to show somewhere? Or should I just wait for a week or two?

Maybe it's me but I'm not sure what this means. Sure 1 day, 2 days, 3 days... but at the end?

image.thumb.png.08b338f3009d2fff6a686212f4f4e45c.png

Can't wait to see what's happening on my site and to show it.

Oh... what I already love is that I can put in different sections with different options like /blog/, /tutorials/, and /such/.

 

You guys worked on this for quite some time, right?

Link to comment
Share on other sites

Hi @wbmnfktr thanks for your feedback!

7 hours ago, wbmnfktr said:

So... I just installed it on a quite crowded site. Is there a way to see in the backend when there is enough data collected to show somewhere? Or should I just wait for a week or two?

Maybe it's me but I'm not sure what this means. Sure 1 day, 2 days, 3 days... but at the end?

Here's briefly how it works with the default values of 1 day, 2 days and 3 days:

Think of the 1st timerange as plan A - it fetches the 10 most viewed pages in the last 24 hours. If for whatever reason there haven't been 10 pages viewed in the past 24 hours, we then move to plan B, which is the 2nd timerange. Here, we look into the past 48 hours for page views.

The 3rd timerange is plan C, in case we still need more articles to complete our list of "10 most viewed pages". So really, the 2nd and 3rd timeranges are like our safety nets to always make sure that we have a full list of 10 pages, regardless of viewer traffic.

But given your site is quite crowded, it's likely that the list will be filled up within the first 24 hours, so you may not ever even need the 2nd and 3rd timeranges.

Regarding the waiting time post-installation: it all depends on your timeranges. If you've set them as 1 day, 2 days, and 3 days, then ideally you'd wait for 3 days. But in practice, if your site has a good traffic volume, you may start seeing your top articles much sooner!
If you adjust your first timerange to be 7 days and 8/9 days as a fallback (10080, 11520 and 12960 minutes) you'd ideally wait for 7-9 days.

Does that make sense?
 

7 hours ago, wbmnfktr said:

Ok, not sure who to ask here but PageHitCounter access to its counter is logged here as 404 - which could be and maybe is correct. Yet I don't know how or if this will mess up MostViewed counts.

I've tidied up the way we log events to prevent any confusion. Just to clarify:
- 404 page-views don't contribute to the count and so, to avoid clutter, they've been removed from the logs, even while debugging.
- another reason for removing 404 from the logs: every missing image, file, etc triggers a 404 - which can and surely will eventually be a lot.
- the tracking of our module isn't affected by what PageHitCounter does, because it's triggering a 404 event that we ignore either way.

 

I've also updated the logs to include the reason each time a page-view gets passed over.
This means not only will you know which views have been tracked, but also which ones weren't tracked and exactly why.

logging.png.8e2580fea2fc90d83ac313e1c0a47f9a.png

 

7 hours ago, wbmnfktr said:

You might want to add ScreamingFrog as a bot/crawler if possible.

Thanks for that - I've also updated the check for crawler. I'm using the same method as PageHitCounter - this seems like a reliable approach.


I have updated the GitHub Repository with the most recent changes. You can check the releases section there to see them.
Alternatively, you should be able to update the module directly from the module configuration in your ProcessWire installation by clicking the link 'check for updates' right next to the module-version.

 

Hope that helped!
Cheers

  • Thanks 1
Link to comment
Share on other sites

10 hours ago, wbmnfktr said:

So... I just installed it on a quite crowded site. Is there a way to see in the backend when there is enough data collected to show somewhere? Or should I just wait for a week or two?

Maybe it's me but I'm not sure what this means. Sure 1 day, 2 days, 3 days... but at the end?

image.thumb.png.08b338f3009d2fff6a686212f4f4e45c.png

Can't wait to see what's happening on my site and to show it.

Oh... what I already love is that I can put in different sections with different options like /blog/, /tutorials/, and /such/.

 

You guys worked on this for quite some time, right?

It should work right away. You should see the tracked pages here: Menu "Setup" > "Most Viewed".

  • Like 1
Link to comment
Share on other sites

On 6/15/2024 at 8:24 AM, update AG said:

Here's briefly how it works with the default values of 1 day, 2 days and 3 days:
[...]

Does that make sense?

Absolutely, yes. Makes totally more sense now to me now.

The lists fill up nicely now. Forgot to delete my cache (ProCache) in-between but now everything looks good.

lcrlog.png.275f19656494bfbe476273152e09b511.png

The log is much cleaner now and ScreamingFrog gets detected. Nice!

And finally found the overview.

Awesome!

  • Like 1
Link to comment
Share on other sites

It's been a while since I installed your module and just kept it in place. Looking into the Most viewed tab today I got confused again.

The 24-hour tab is way too empty for my taste and is off compared to my analytics, which already only receives a small part of user views/impressions.

2024-06-23_22-03.thumb.png.bca96b223148477ce760e8dbf6225393.png

The 48-hour tab looks better but I still don't trust those numbers.

2024-06-23_22-04.thumb.png.c721c48bb4f112ffa3077b50ae136b83.png

 

What part am I missing here? Is it still my understanding of those numbers or could there be something wrong in my setup for your module? Your module runs in two projects which are almost similar to identical in terms of setup and modules. Perfect for testing and to play around with. So it's not critical at all and more kind of a feedback here.

  • ProcessWire 3.0.240
  • PHP 8.2
  • ProCache (latest)
  • NO URL Hooks in place
  • On one instance: TemplateEngineTwig by @Wanze for templating and rendering pages

 

Link to comment
Share on other sites

I'm a bit puzzled about what might have gone wrong here since your project settings appear correct.
The module is also compatible with ProCache enabled, so that shouldn't be an issue. Could you please share your Module-Config so I can analyze the problem further?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...