What is HitsPage?¶
HitsPage is a Plugin that counts the number of http requests, or "hits" on a given web page.
MODX Revolution 2.1.x or later
HitsPage was written by Valentine Rasulov and released October 27th, 2011
It can be downloaded from within the MODX Revolution manager via Package Management, or from the MODX Extras Repository, here:
Upon installation, HitsPage creates two new Template Variables, "HitsPage" and "hits". At the time of this writing, the "hits" TV is redundant.
On the Resource that you'd like to track hits, use the placeholder:
You can put this in the Resource Content Field, or in its Template, but it MUST be present on the page you wish to track. You can hide its display using CSS, if you wish.
Idiosyncratic Behaviour Do NOT use the TV tag to render output on the page. It seems to break the plugin. Only use it in &tpl chunks (see below).
A getResources call using the following &tpl will return a list of pages displaying their Titles and the number of hits they've received:
<li>[[+pagetitle]] has been viewed [[+tv.HitsPage]] times.</li>
Usage Example You can easily create a "Most Popular Posts" widget by following the tutorial here: http://www.sepiariver.ca/blog/modx-web/modx-popular-posts-plugin-hit-counter-getresources