{"id":51496982,"url":"https://github.com/daun/analytics-plugin-matomo","last_synced_at":"2026-07-07T16:30:28.258Z","repository":{"id":368180192,"uuid":"1283771291","full_name":"daun/analytics-plugin-matomo","owner":"daun","description":"Matomo integration for analytics","archived":false,"fork":false,"pushed_at":"2026-06-29T11:12:07.000Z","size":41,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-29T12:22:21.899Z","etag":null,"topics":["analytics","analytics-plugin","matomo"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daun.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-29T08:14:35.000Z","updated_at":"2026-06-29T11:12:11.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/daun/analytics-plugin-matomo","commit_stats":null,"previous_names":["daun/analytics-plugin-matomo"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/daun/analytics-plugin-matomo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fanalytics-plugin-matomo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fanalytics-plugin-matomo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fanalytics-plugin-matomo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fanalytics-plugin-matomo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daun","download_url":"https://codeload.github.com/daun/analytics-plugin-matomo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daun%2Fanalytics-plugin-matomo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35235814,"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-07-07T02:00:07.222Z","response_time":90,"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":["analytics","analytics-plugin","matomo"],"created_at":"2026-07-07T16:30:27.364Z","updated_at":"2026-07-07T16:30:28.222Z","avatar_url":"https://github.com/daun.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Matomo Plugin for `analytics`\n\n[Matomo](https://matomo.org/) integration for [analytics](https://www.npmjs.com/package/analytics), a lightweight open-source frontend analytics abstraction layer.\n\n## Installation\n\nInstall `analytics` and `analytics-plugin-matomo` packages.\n\n```bash\nnpm install analytics\nnpm install analytics-plugin-matomo\n```\n\n## Setup\n\nInitialize the plugin with analytics.\n\n```js\nimport Analytics from 'analytics'\nimport matomoPlugin from 'analytics-plugin-matomo'\n\nconst analytics = Analytics({\n  app: 'awesome-app',\n  plugins: [\n    matomoPlugin({\n      installationUrl: '/matomo/',\n      siteId: 1,\n    })\n  ]\n})\n```\n\n## Usage\n\nThe plugin loads and configures Matomo's [tracking script](https://developer.matomo.org/guides/tracking-javascript-guide), then sends data whenever [analytics.identify](https://getanalytics.io/api/#analyticsidentify), [analytics.page](https://getanalytics.io/api/#analyticspage), or [analytics.track](https://getanalytics.io/api/#analyticstrack) is called.\n\nIf you already include the Matomo tracking script in your templates, remove it to avoid double tracking.\n\n```js\n/* Track a page view */\nanalytics.page()\n\n/* Track a custom event */\nanalytics.track('Add', {\n  category: 'Cart',\n  name: 'Ice Cubes',\n  value: 3\n})\n\n/* Identify a visitor */\nanalytics.identify('user-id-xyz')\n```\n\n## API\n\n### Core methods\n\n- **[analytics.identify](https://getanalytics.io/api/#analyticsidentify)** - Identify a visitor.\n- **[analytics.page](https://getanalytics.io/api/#analyticspage)** - Send a page view.\n- **[analytics.track](https://getanalytics.io/api/#analyticstrack)** - Send a custom event.\n\n### Plugin methods\n\n#### `paq(...args)`\n\nPush a raw command onto Matomo's `_paq` queue.\n\n```js\nanalytics.plugins.matomo.paq(['setUserId', 'user-123'])\n```\n\n## Configuration\n\n### Registration\n\n- **`installationUrl`** — Base URL of your Matomo installation. Used to derive the tracker and script URLs (`matomo.php` and `matomo.js`). Required.\n- **`siteId`** — Matomo site ID. Required.\n- **`trackerUrl`** — Custom tracker endpoint URL. Overrides the value derived from `installationUrl`. Optional.\n- **`scriptUrl`** — Custom tracking script URL. Overrides the value derived from `installationUrl`. Optional.\n\n### Privacy \u0026 Cookies\n\n- **`requireConsent`** — Withhold all tracking until consent is granted via `updateConsent()`. Default: `false`.\n- **`requireCookieConsent`** — Track without cookies until  consent is granted via `updateConsent()`. Default: `false`.\n- **`disableCookies`** — Disable all first-party cookies (cookieless tracking). Default: `false`.\n- **`doNotTrack`** — Respect the browser's Do Not Track setting. Default: `false`.\n- **`cookieDomain`** — Cookie domain, e.g. `*.example.com` to share cookies across subdomains.\n- **`secureCookie`** — Set the `Secure` flag on all first-party cookies (HTTPS-only sites). Default: `false`.\n- **`cookieSameSite`** — `SameSite` attribute for tracking cookies: `'Lax'` (Matomo default), `'None'`, or `'Strict'`.\n\n### Features\n\n- **`enableLinkTracking`** — Track clicks on outbound links and downloads. Default: `true`.\n- **`enableHeartBeatTimer`** — Improve time-on-page accuracy. `true` uses the Matomo default active time, a number sets the active time in seconds, `false` disables it. Default: `true`.\n- **`enableCrossDomainLinking`** — Stitch visits across multiple owned domains. Default: `false`.\n- **`disablePerformanceTracking`** — Disable page performance tracking. Default: `false`.\n\nThese cover the most common Matomo settings. For the complete, authoritative list of options and their types, see the config definition in the source: [`src/types.ts`](https://github.com/daun/analytics-plugin-matomo/blob/main/src/types.ts).\n\n### Other Matomo settings\n\nThe plugin only maps a subset of Matomo's tracking API to config options. For anything not listed above, push the raw command yourself with [`paq`](#paqargs). For example, to set a custom dimension:\n\n```js\nanalytics.plugins.matomo.paq(['setCustomDimension', 1, 'premium-user'])\n```\n\n## Consent Handling\n\nBy default, the plugin tracks everything without awaiting consent. Two plugin options change this. Both use the `updateConsent` method to grant or revoke consent at runtime.\n\n- **No consent** (default): leave both options unset. All events are tracked.\n- **`requireConsent: true`**: no tracking until consent is granted.\n- **`requireCookieConsent: true`**: tracking starts immediately without cookies; cookies are set once consent is granted. Use this for cookieless tracking that adds cookies later for more accurate tracking data.\n\n```js\nconst analytics = Analytics({\n  app: 'awesome-app',\n  plugins: [\n    matomoPlugin({\n      requireConsent: true,\n    })\n  ]\n})\n\n// Later... grant consent for tracking from consent dialog\nanalytics.plugins.matomo.updateConsent(true)\n```\n\n## Supported Platforms\n\nThe Matomo plugin works in the browser. Node is currently not supported.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaun%2Fanalytics-plugin-matomo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaun%2Fanalytics-plugin-matomo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaun%2Fanalytics-plugin-matomo/lists"}