Skip to content

Minimal Caddy middleware for tracking HTTP requests

License

Notifications You must be signed in to change notification settings

jraedisch/caddilytics

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Caddilytics

GoDoc

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

Any advice/criticism/PRs are welcome!

Version 2 Compatibility

Caddilytics is compatible with Caddy V2 only. Earlier commits supported Caddy pre V1, so feel free to browse history for info.

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

You will also have to define a global order (or a route) in your Caddyfile:

{
  order caddilytics before header
}

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).

About

Minimal Caddy middleware for tracking HTTP requests

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages