Skip to content

kemeter/sozune-umami

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sozune-umami

An Umami analytics feeder compiled to WebAssembly, run as a Sōzune plugin.

For each tracked request it builds an Umami /api/send pageview event and fires it with Sōzune's fire-and-forget http_send extension — the visitor's request is never delayed waiting on Umami, and the analytics response is never read. Server-side analytics with no client-side JavaScript or cookies.

Inspired by the Go traefik-umami-feeder.

Build

cargo build --release --target wasm32-unknown-unknown
# -> target/wasm32-unknown-unknown/release/sozune_umami.wasm

Use with Sōzune

umami_host must be in allowed_hosts so the proxy permits the outbound call.

# config.yaml
plugins:
  umami:
    path: /plugins/sozune_umami.wasm
    allowed_hosts: ["umami:3000"]
    config:
      umami_host: "http://umami:3000"
      websites:
        app.example.com: "<website-id>"
labels:
  - "sozune.enable=true"
  - "sozune.http.app.host=app.example.com"
  - "sozune.http.app.plugins=umami"

Only requests whose Host is a key in websites are tracked; the matching id is sent in the event. Requests for non-content assets (.css, .js, images, …) are skipped.

Configuration

Key Description
umami_host Base URL of the Umami instance, e.g. http://umami:3000. Required. Must be in the plugin's allowed_hosts.
websites Map of hostname → website id. Only listed hosts are tracked.

No Umami API token is needed: /api/send does not require authentication.

Limitations

  • Request-phase tracking. The http-wasm ABI exposes the request only in the request phase, so tracking happens there. Unlike the Go plugin, events are not filtered by backend status code — every tracked request is reported.
  • No batching. One beacon per request (enqueued, non-blocking). The proxy's sink may still batch on its side.

License

MIT.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages