A post was split to a new topic: How to programmatically get the most viewed products for a particular category?