{"id":50777790,"url":"https://github.com/avvertix/caddy-plausible-analytics","last_synced_at":"2026-06-12T01:03:20.328Z","repository":{"id":356138804,"uuid":"1197360469","full_name":"avvertix/caddy-plausible-analytics","owner":"avvertix","description":"Caddy module to track request visits server-side using Plausible Analytics","archived":false,"fork":false,"pushed_at":"2026-05-06T18:40:52.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-06T20:34:14.540Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/avvertix.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-31T14:19:19.000Z","updated_at":"2026-05-06T18:40:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/avvertix/caddy-plausible-analytics","commit_stats":null,"previous_names":["avvertix/caddy-plausible-analytics"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/avvertix/caddy-plausible-analytics","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avvertix%2Fcaddy-plausible-analytics","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avvertix%2Fcaddy-plausible-analytics/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avvertix%2Fcaddy-plausible-analytics/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avvertix%2Fcaddy-plausible-analytics/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avvertix","download_url":"https://codeload.github.com/avvertix/caddy-plausible-analytics/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avvertix%2Fcaddy-plausible-analytics/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34224103,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-11T02:00:06.485Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-12T01:03:17.735Z","updated_at":"2026-06-12T01:03:20.311Z","avatar_url":"https://github.com/avvertix.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Plausible Analytics module for Caddy\n\nA Caddy middleware module that tracks server-side pageviews by forwarding events to a [Plausible Analytics](https://plausible.io) instance. Works with both the hosted service and self-hosted deployments.\n\n## How It Works\n\nThe middleware sits in the Caddy handler chain. For each request it:\n\n1. Wraps the `ResponseWriter` to capture the HTTP status code and response `Content-Type`\n2. Delegates the request to the next handler (the client receives the response immediately)\n3. Fires an asynchronous pageview event to Plausible — the client is never kept waiting\n\nRequests are silently skipped and never forwarded to Plausible when:\n\n- The response status is 4xx or 5xx\n- The requested path ends with a static asset extension (`.css`, `.js`, `.png`, `.jpg`, `.jpeg`, `.gif`, `.svg`, `.webp`, `.ico`, `.bmp`, `.tiff`, `.mp3`, `.mp4`, `.avi`, `.mov`, `.webm`, `.ogg`, `.wav`, `.flac`, `.woff`, `.woff2`, `.ttf`, `.map`)\n\nThe original visitor's `User-Agent` and IP address are forwarded to Plausible so its own bot-filtering and geo-lookup work correctly.\n\n## Installation\n\n### Using xcaddy\n\n```bash\nxcaddy build --with github.com/avvertix/caddy-plausible-analytics\n```\n\n### Using Docker\n\nA sample Docker setup is included. It builds a custom Caddy image with the module baked in.\n\n```bash\n# Build and start\ndocker compose up --build\n```\n\n## Caddyfile Configuration\n\n### Minimal\n\n`plausible` is not a standard ordered directive, so register its position in the global options block:\n\n```caddyfile\n{\n    order plausible before file_server\n}\n\nexample.com {\n    plausible {\n        domain_name example.com\n    }\n    file_server\n}\n```\n\n### With a self-hosted Plausible instance\n\n```caddyfile\n{\n    order plausible before file_server\n}\n\nexample.com {\n    plausible {\n        domain_name example.com\n        base_url    https://plausible.yourhost.com\n    }\n    file_server\n}\n```\n\n### With custom properties\n\n```caddyfile\n{\n    order plausible before file_server\n}\n\nexample.com {\n    plausible {\n        domain_name example.com\n        props       content_type device_type\n    }\n    file_server\n}\n```\n\n### Directives\n\n| Directive | Default | Description |\n|---|---|---|\n| `domain_name` | — | **Required.** Site domain as configured in your Plausible dashboard |\n| `base_url` | `https://plausible.io` | Root URL of the Plausible instance; override for self-hosted deployments |\n| `props` | _(none)_ | Space-separated list of custom properties to attach to each event (see below) |\n\n### Custom properties\n\nCustom properties are opt-in. List the ones you want under `props`:\n\n| Property | Source | Example values |\n|---|---|---|\n| `content_type` | MIME type of the response `Content-Type` header (charset stripped) | `text/html`, `application/json` |\n| `device_type` | Coarse device class derived from `User-Agent` | `desktop`, `mobile`, `tablet`, `bot` |\n\n## JSON Configuration\n\n```json\n{\n  \"handler\": \"plausible\",\n  \"domain_name\": \"example.com\",\n  \"base_url\": \"https://plausible.io\",\n  \"props\": [\"content_type\", \"device_type\"]\n}\n```\n\n## Development\n\n```bash\n# Run tests\ngo test -v -race ./...\n\n# Build Caddy locally with the module (requires xcaddy)\nxcaddy build --with github.com/avvertix/caddy-plausible-analytics=.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favvertix%2Fcaddy-plausible-analytics","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favvertix%2Fcaddy-plausible-analytics","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favvertix%2Fcaddy-plausible-analytics/lists"}