This question is mostly considering the desktop category page style Boxes with Featured Topics
The problem is as follows: I have roughly 20 categories, and want to order them roughly based on how many views the category gets. So if Category A has had the most total views, then it is in position 1. If Category B has had the second most total views, then I can put it into position 2 and so on. However, from time to time I want to spotlight a category which does not have many views by manually putting them in the 3rd or 4th slot.
I suspect this might be possible with a data explorer query, but it might be non-trivial. Is there already an easy way of achieving this information? Maybe there is existing information in some of the reports I could re-purpose?
I think you could use the topic_views table to grab a count of the latest views for a topic, and group/sum that by category? The topic_views table counts one new view a day though, rather than ‘1-per-8-hours’ so it may give a smaller figure than you may be expecting when compared to the topics.views number.
Whilst working on a different Data Explorer query, I found something which provides information I think might be more useful. There is a query which ships with core called “Number of replies by Category”
Assuming the ID is the same for every site, then appending this to your domain should provide the same query
/admin/plugins/explorer?id=-18¶ms=%7B%7D
If someone was looking specifically for the views only, then I’m sure they could re-purpose that query. Essentially combine the suggestion from Jammy with this one and you get the result.