Minimal Caddy middleware for tracking HTTP requests
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
caddilytics.go
caddilytics_test.go

README.md

Caddilytics

GoDoc

This repository contains a minimal Caddy middleware for tracking HTTP requests via Google Analytics Measurement Protocol.

Any advice/criticism/PRs are welcome!

Tracking Info

All requests are being tracked as pageviews with the following data:

  • dl (location URL)
  • dr (referer)
  • ua (user agent)
  • ul (language)

Tracking is done asynchronously with a timeout of 1 second.

Usage (configurable per site):

caddilytics UA-1234-5 session-cookie

Cookie

A http only, secure session cookie will be set with an unencrypted random UUID if none is set already.

TODO (unordered ideas)

  • Clean up specs.
  • Allow non secure cookies.
  • Better documentation, especially about building caddy.
  • Log exceptions with exd (exception description) as hit type exception.
  • Track qt (queue time).
  • Track timing.

License

Copyright (c) 2017 Jasper Rädisch. See the LICENSE file for license rights and limitations (MIT).