{"id":17526499,"url":"https://github.com/1cedsoda/traefik-umami-plugin","last_synced_at":"2025-03-06T06:30:34.329Z","repository":{"id":223488134,"uuid":"759850740","full_name":"1cedsoda/traefik-umami-plugin","owner":"1cedsoda","description":"Integrate Umami into any web service. Request forwarding, script injection and server side tracking.","archived":false,"fork":false,"pushed_at":"2024-04-01T17:54:49.000Z","size":200,"stargazers_count":10,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-21T15:17:56.724Z","etag":null,"topics":["traefik","traefik-plugin","umami"],"latest_commit_sha":null,"homepage":"https://plugins.traefik.io/plugins/65d4cc8e769af9e5f2251e09/umami-analytics","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/1cedsoda.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2024-02-19T13:07:35.000Z","updated_at":"2024-05-30T18:59:49.000Z","dependencies_parsed_at":"2024-02-23T11:30:27.704Z","dependency_job_id":"d3d53114-61bf-4062-ae3f-86d18f72460a","html_url":"https://github.com/1cedsoda/traefik-umami-plugin","commit_stats":null,"previous_names":["1cedsoda/traefik-umami-plugin"],"tags_count":4,"template":false,"template_full_name":"traefik/plugindemo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1cedsoda%2Ftraefik-umami-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1cedsoda%2Ftraefik-umami-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1cedsoda%2Ftraefik-umami-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/1cedsoda%2Ftraefik-umami-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/1cedsoda","download_url":"https://codeload.github.com/1cedsoda/traefik-umami-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242161208,"owners_count":20081824,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["traefik","traefik-plugin","umami"],"created_at":"2024-10-20T15:01:50.280Z","updated_at":"2025-03-06T06:30:34.316Z","avatar_url":"https://github.com/1cedsoda.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"![Traefik with Umami traefik-umami-plugin](.assets/traefik-x-umami.png)\n\n# traefik-umami-plugin\n\nUse [Umami Analytics](https://umami.is) with the [Traefik Reverse Proxy](https://traefik.io/traefik/).\n\nThis plugin enables you to build a [middleware](https://doc.traefik.io/traefik/middlewares/overview/) to provide umami anytics to any web servive.\n\nPros:\n- No need to modify the web service\n- Harder to block by adblockers\n- No need for JavaScript Fetching\n- No need for JavaScript\n\n# Features\n- [X] Script Tag Injection - Inject the `script.js` as a script tag\n- [X] Script Source Injection - Inject the `script.js` as raw JS code\n- [X] Request Forwarding - Forward requests behind `forwardingPath` to th unami server\n- [X] Server Side Tracking - Trigger tracking event from the plugin, No JS needed.\n- [ ] Injection when compressed - [Issue](https://github.com/1cedsoda/traefik-umami-plugin/issues/2), [PR in progress](https://github.com/1cedsoda/traefik-umami-plugin/pull/3)\n\n# Installation\nTo [add this plugin to traefik](https://plugins.traefik.io/install) reference this repository as a plugin in the static config.\nThe version references a git tag.\n\n```yaml\nexperimental:\n  plugins:\n    traefik-umami-plugin:\n      moduleName: \"github.com/1cedsoda/traefik-umami-plugin\"\n      version: \"v1.0.2\" \n```\n```toml\n[experimental.plugins.traefik-umami-plugin]\n  moduleName = \"github.com/1cedsoda/traefik-umami-plugin\"\n  version = \"v1.0.2\"\n```\nWith the plugin installed, you can configure a middleware in a dynamic configuration such as a `config.yml` or docker labels.\nInside `traefik-umami-plugin` the plugin can be configured.\n\nOnly `umamiHost` and `websiteId` options are required to get started.\nThe middleware can then be used in a [router](https://doc.traefik.io/traefik/routing/routers/#middlewares_1). Remember to reference the correct [provider namespace](https://doc.traefik.io/traefik/providers/overview/#provider-namespace).\n\n\n```yaml\nhttp:\n  middlewares:\n    my-umami-middleware:\n      plugin:\n        traefik-umami-plugin:\n          umamiHost: \"umami:3000\"\n          websiteId: \"d4617504-241c-4797-8eab-5939b367b3ad\"\n          forwardPath: \"umami\"\n          scriptInjection: true\n          scriptInjectionMode: \"tag\"\n          autoTrack: true\n          doNotTrack: false\n          cache: false\n          domains:\n            - \"example.com\"\n          evadeGoogleTagManager: false\n          serverSideTracking: false\n          serverSideTrackingMode: \"all\"\n```\n```toml\n[http.middlewares]\n  [http.middlewares.umami.plugin.traefik-umami-plugin]\n    umamiHost = \"umami:3000\"\n    websiteId = \"d4617504-241c-4797-8eab-5939b367b3ad\"\n    forwardPath = \"umami\"\n    scriptInjection = true\n    scriptInjectionMode = \"tag\"\n    autoTrack = true\n    doNotTrack = false\n    cache = false\n    domains = [\"example.com\"]\n    evadeGoogleTagManager = false\n    serverSideTracking = false\n```\n\n# Configuration\n## Umami Server\n\n| key         | default | type     | description                                                                    |\n| ----------- | ------- | -------- | ------------------------------------------------------------------------------ |\n| `umamiHost` | -       | `string` | Umami server host, reachable from within traefik (container). eg. `umami:3000` |\n| `websiteId` | -       | `string` | Website ID as configured in umami.                                             |\n\n\n## Request Forwarding\n\nRequest forwarding allows for the analytics related requests to be hosted on the same domain as the web service. This makes it harder to block by adblockers.\nRequest forwarding is always enabled.\n\n| key           | default | type     | description                                               |\n| ------------- | ------- | -------- | --------------------------------------------------------- |\n| `forwardPath` | `umami` | `string` | Forwards requests with this URL prefix to the `umamiHost` |\n\nRequests with a matching URL are forwarded to the `umamiHost`. The path is preserved.\n\n- `https://mywebsite.example/\u003cforwardPath\u003e/script.js` -\u003e `\u003cumamiHost\u003e/script.js`\n- `https://mywebsite.example/\u003cforwardPath\u003e/api/send` -\u003e `\u003cumamiHost\u003e/api/send`\n\n## Script Injection\n\nIf `scriptInjection` is enabled (by default) and the response `Content-Type` is `text/html`, the plugin will inject the Umami script tag/source at the end of the response body.\n\nThe [`data-website-id`](https://umami.is/docs/tracker-configuration#data-domains) will be set to the `websiteId`.\n\n| key                     | default | type       | description                                                                                          |\n| ----------------------- | ------- | ---------- | ---------------------------------------------------------------------------------------------------- |\n| `scriptInjection`       | `true`  | `bool`     | Injects the Umami script tag into the response                                                       |\n| `scriptInjectionMode`   | `tag`   | `string`   | `tag` or `source`. See below                                                                         |\n| `autoTrack`             | `true`  | `bool`     | See original docs [data-auto-track](https://umami.is/docs/tracker-configuration#data-host-url)       |\n| `doNotTrack`            | `false` | `bool`     | See original docs [data-do-not-track](https://umami.is/docs/tracker-configuration#data-do-not-track) |\n| `cache`                 | `false` | `bool`     | See original docs [data-cache](https://umami.is/docs/tracker-configuration#data-cache)               |\n| `domains`               | `[]`    | `[]string` | See original docs [data-domains](https://umami.is/docs/tracker-configuration#data-domains)           |\n| `evadeGoogleTagManager` | `false` | `bool`     | See original docs [Google Tag Manager](https://umami.is/docs/tracker-configuration)                  |\n\nThere are two modes for script injection:\n- `tag`: Injects the script tag with `src=\"/\u003cforwardPath\u003e/script.js\"` into the response\n- `source`: Downloads \u0026 injects the script source into the response\n\n## Server Side Tracking\n\nThe plugin can be configured to send tracking events to the Umami server as requests come in. This removes the need for JavaScript on the client side.\nIt also allows to track pages that are not `text/html` or are not rendered by a browser.\n\nHowever, it is not possible to track `title` or `display` values, as they are not available on the server side.\n\nSST can be combined with script injection, but it is recommended to turn of `autoTrack` to avoid double tracking.\n\nTracked events have the name `traefik`.\n\nThe `domains` configuration is considered for SST as well. If domains is empty, all hosts are tracked, otherwise the host must be in the list. The port of the host is ignored.\n\n| key                      | default | type     | description                       |\n| ------------------------ | ------- | -------- | --------------------------------- |\n| `serverSideTracking`     | `false` | `bool`   | Enables server side tracking      |\n| `serverSideTrackingMode` | `all`   | `string` | `all` or `notinjected`. See below |\n\nThe mode `notinjected` is useful if you want to use SST and script injection at the same time, but want to avoid double tracking. Perfect for full analytics coverage of your web service.\nThere are two modes for server side tracking:\n- `all`: Tracks all requests\n- `notinjected`: Tracks all requests that have not been injected (always if `scriptInjection` is disabled)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1cedsoda%2Ftraefik-umami-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F1cedsoda%2Ftraefik-umami-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F1cedsoda%2Ftraefik-umami-plugin/lists"}