Tracking visits

One of the most interesting features in Shlink is the visits tracking.

Shlink will track every time your short URLs are opened, and then try to geolocate the visitor.

Considerations

In order to geolocate visits, Shlink makes use of a GeoLite2 database, by MaxMind, which is used to match the location of the visitor’s IP address.

To make sure your GeoLite2 db is always up-to-date, you will have to configure your own license key.

Also, Shlink will make sure you fulfil most data protection regulations, by storing only an anonymized version of the visitor’s IP address (unless deliberately opting-out of this behavior).

Orphan visits

Starting with v2.6.0, Shlink can also track visits to any URL that would usually result in a “404 - Not found” error, also known as orphan visits.

These visits can have one of these types:

  • base_url: Someone opened the base URL in which Shlink is hosted.
  • invalid_short_url: Someone opened a short-url-like URL, but it did not resolve an existing short URL, or it was disabled.
  • regular_404: Someone opened a route which Shlink didn’t understand.

The visits will be tracked both if you configure special redirects from those three cases, but also if you leave Shlink serve a regular 404 status with a “Not found” template.

In case you don’t need this, you can opt out from orphan visits tracking via env vars or installation tool’s config options.

Disable tracking

Since v2.7.0, Shlink provides a more granular way to disable visits tracking, either completely or partially.

Via configuration or env vars, you will be able to:

  • Completely disable tracking: All short URLs will display they had 0 visits.
  • Disable IP address tracking: The visits will be counted, but they will all show they come from an unknown location.
  • Disable referrer tracking: All visits will be counted and located, but Shlink will not track the referrer.
  • Disable user agent tracking: All visits will be counted and located, but Shlink will not track the user agent.