Problem / Motivation
When managing redirects over time, the list grows and accumulates entries that may no longer be triggered (the old URLs are no longer linked anywhere) or that point to content which has since moved again. Without any usage signal there is no safe way to identify stale redirects for cleanup, and no way to confirm that a freshly created redirect is actually being hit.
Two small data points would cover most of this need:
- how often a redirect has matched (hit count)
- when it last matched (last used timestamp)
Proposed solution
Record two values per redirect whenever it matches an incoming request:
hits (integer counter, incremented on each match)
last_used_at (timestamp, updated on each match)
Surface both as read-only, sortable columns in the redirects listing in the Control Panel, so stale entries (zero hits, or nothing for a long time) are easy to spot.
To stay aligned with the "simple by design" philosophy, this should be:
- opt-in / disableable via a config flag (e.g.
track_usage, off by default), so anyone who does not want it pays no cost and stores no extra data
- non-blocking, so tracking never adds latency or failure risk to the redirect response itself
Driver / performance note (decision left to the maintainer)
The addon supports both the flat-file and the Eloquent driver. Incrementing a counter on every hit is straightforward with Eloquent but problematic with flat files, where a write on every request against a YAML/Markdown file raises performance and concurrency concerns. Possible directions, entirely at your discretion:
- limit usage tracking to the Eloquent driver
- batch or throttle writes (e.g. flush counters from cache/queue periodically instead of on every request)
- store hits in a small separate store rather than in the redirect entry itself
The feature itself does not depend on a specific storage strategy.
Alternatives considered
The Redirect addon by Rias offers full analytics. For sites that deliberately chose this addon for its simplicity, pulling in a heavier addon just to see whether a redirect is used is more than the use case warrants. A minimal, opt-in hit count and last-used timestamp covers the common cleanup and verification need without turning this into an analytics product.
Problem / Motivation
When managing redirects over time, the list grows and accumulates entries that may no longer be triggered (the old URLs are no longer linked anywhere) or that point to content which has since moved again. Without any usage signal there is no safe way to identify stale redirects for cleanup, and no way to confirm that a freshly created redirect is actually being hit.
Two small data points would cover most of this need:
Proposed solution
Record two values per redirect whenever it matches an incoming request:
hits(integer counter, incremented on each match)last_used_at(timestamp, updated on each match)Surface both as read-only, sortable columns in the redirects listing in the Control Panel, so stale entries (zero hits, or nothing for a long time) are easy to spot.
To stay aligned with the "simple by design" philosophy, this should be:
track_usage, off by default), so anyone who does not want it pays no cost and stores no extra dataDriver / performance note (decision left to the maintainer)
The addon supports both the flat-file and the Eloquent driver. Incrementing a counter on every hit is straightforward with Eloquent but problematic with flat files, where a write on every request against a YAML/Markdown file raises performance and concurrency concerns. Possible directions, entirely at your discretion:
The feature itself does not depend on a specific storage strategy.
Alternatives considered
The Redirect addon by Rias offers full analytics. For sites that deliberately chose this addon for its simplicity, pulling in a heavier addon just to see whether a redirect is used is more than the use case warrants. A minimal, opt-in hit count and last-used timestamp covers the common cleanup and verification need without turning this into an analytics product.