{hitcounter:type:ids:from}

Description

Renders a per-day hit-statistics table plus trend charts for one or more items, built from the hit_archive log that AA writes on every public page view. Give it a time grouping (the type parameter), a dash-joined list of item ids, and optionally an earliest timestamp. The output is HTML and ChartJS canvases, so it belongs in an admin page or template, not in an RSS/JSON view. What it shows is the install live traffic: an empty or unrecognized type, or items that have no logged hits, render nothing at all. This is the same renderer the admin Statistics page uses.

Parameters

type required

Time grouping for the rows of the table and the x-axis of the charts. One of the values listed below. An empty or unrecognized type makes the whole command output nothing, so type is effectively required.

ids optional

The items to report on, as a dash-joined list of ids. Both forms work: a 32-character long id or a short numeric id, mixed freely (split on the dash, blanks dropped). With one id you get a single-item view; with several, each gets its own columns and an all summary column is added. Items with no logged hits contribute nothing.

from optional default empty (no lower bound)

Optional earliest time to include, as a Unix timestamp (seconds since 1970). Hits logged before it are excluded; an empty value (the default) means no lower bound, so the whole history is counted. There is no upper-bound parameter.

Examples

virtual{hitcounter:days:24457-24474-24501}
Expected(one column group per item plus an all summary column; values depend on logged traffic)
Pass a dash-joined list to compare items side by side. Each item gets its own columns and an extra all column sums across them. Long 32-character ids and short numeric ids may be mixed in the same list.
virtual{hitcounter:days:24457}
Expected(a per-day Hits table plus a trend chart for item 24457; exact rows depend on this installs traffic)
The everyday call: per-day hit counts for one item (here short id 24457), newest grouping first. You get a stats table and a Hits trend chart; if the AddDurationLog feature is on you also get cache % and average render time columns. Output is HTML, so use it on an admin page or template, not in an RSS view.
test[{hitcounter::5726c2c6b035d7aab450d1794e9e90d7}]
Expected[]
Actual[]
With no type, the command returns an empty string. The brackets show there is no output between them. So type is effectively required: leave it out and nothing renders.
virtual{hitcounter:months:24457}
Expected(a per-month Hits table and chart for item 24457)
Swap the type to change the grouping. months buckets by calendar month (Y-m); the other choices are minutes, hours, days, dayhours, weeks, weekdays and years. Coarser groupings suit long histories; finer ones suit short recent windows.
test[{hitcounter:days:5726c2c6b035d7aab450d1794e9e90d7}]
Expected[]
Actual[]
A valid call against an item that has no rows in the hit_archive log produces no table and no charts - an empty string. This fixture item is never hit, so days grouping has nothing to show.
virtual{hitcounter:days:24457:1185919200}
Expected(the days table for item 24457, counting only hits from 2007-08-01 onward)
The third parameter is a Unix timestamp: only hits at or after it are counted. 1185919200 is 2007-08-01. Combine it with the ids expression below to compute the timestamp from a field instead of hard-coding it.
virtual{hitcounter:days:{ids:76f59b2023b8a4e8d6c57831ef8c8199:d-publish_date....-LIKE-2024*}}
Expected(the days table for whichever items the inner {ids:} returns)
The ids parameter is just text, so you can build it with another expression. Here {ids:...} returns the dash-joined ids of every item in a slice published in 2024, and {hitcounter:} reports on exactly those. This is the pattern the admin Statistics page uses.
test[{hitcounter:daily:5726c2c6b035d7aab450d1794e9e90d7}]
Expected[]
Actual[]
A type that is not one of the recognized tokens (here daily, when the day grouping is actually called days) is treated like no type at all: the whole command outputs nothing. Mind the exact spelling.