Jump to main content Jump to doc navigation

What is HitsPage?

HitsPage is a Plugin that counts the number of http requests, or "hits" on a given web page.

Requirements

MODX Revolution 2.1.x or later

History

HitsPage was written by Valentine Rasulov and released October 27th, 2011

Download

It can be downloaded from within the MODX Revolution manager via Package Management, or from the MODX Extras Repository, here:

https://modx.com/extras/package/hitspage

Usage

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:

[[!+hitss]]

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).

Once the placeholder is...in place, the "HitsPage" TV will be dynamically updated with the hit count, making it available to Snippets via their Tpl Chunks.

Examples

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