/every-click-counts

YOURLS plugin to count every click, that is, including multiple clicks for the same client.

Primary LanguagePHPMIT LicenseMIT

Every Click Counts

Plugin for YOURLS 1.5+.

Description

This plugin, aptly named "Every Click Counts", is for counting every click. That is, including multiple clicks for the same client. This is done by not caching the HTTP 301 redirects.

Installation

  1. In /user/plugins, create a new folder named every-click-counts.
  2. Drop these files in that directory.
  3. Go to the Plugins administration page ( e.g. http://sho.rt/admin/plugins.php ) and activate the plugin.
  4. Have fun (with counts in large amounts)!

License

Background

This plugin prevents the caching of HTTP 301 redirects as issued by YOURLS for every short URL. With such a redirect cached in a client browser, the client will not hit the server with the YOURLS installation on subsequent visits of the respective short URL (but rather jump directly to the corresponding long URL). Consequently, only a first client hit of a short URL can be counted by YOURLS. In other words, subsequent hits are not included in the clicks statistics.

Some people may want to track every click instead, that is, also track multiple clicks for the same client. If this is what you want: OK, this is exactly what the plugin was made for. If activated, HTTP 301 redirects are not cached anymore.

To flawlessly see your own multiple clicks as an admin counted, notice the following: if you had already used your YOURLS install before activating this plugin, you may first want to get rid of the redirects already cached in your browser. Depending on the particular browser you are using, this might be more or less elaborate, e.g. see this discussion on stackoverflow.com.