{"id":23123370,"url":"https://github.com/openmost/nuxt-matomo","last_synced_at":"2025-04-04T04:24:14.437Z","repository":{"id":195736008,"uuid":"693544303","full_name":"openmost/nuxt-matomo","owner":"openmost","description":"Matomo module for Nuxt 3","archived":false,"fork":false,"pushed_at":"2025-01-25T16:36:35.000Z","size":783,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-10T16:41:12.055Z","etag":null,"topics":["matomo","matomo-sdk","nuxt","nuxt-matomo","nuxt-matomo-tag-manager","nuxt-module","nuxt3"],"latest_commit_sha":null,"homepage":"https://openmost.io/products/nuxt-matomo/","language":"TypeScript","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/openmost.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}},"created_at":"2023-09-19T08:34:09.000Z","updated_at":"2025-02-27T14:56:30.000Z","dependencies_parsed_at":"2023-09-19T11:56:52.677Z","dependency_job_id":null,"html_url":"https://github.com/openmost/nuxt-matomo","commit_stats":null,"previous_names":["openmost/nuxt-matomo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fnuxt-matomo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fnuxt-matomo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fnuxt-matomo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/openmost%2Fnuxt-matomo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/openmost","download_url":"https://codeload.github.com/openmost/nuxt-matomo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247119524,"owners_count":20886754,"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":["matomo","matomo-sdk","nuxt","nuxt-matomo","nuxt-matomo-tag-manager","nuxt-module","nuxt3"],"created_at":"2024-12-17T07:33:50.024Z","updated_at":"2025-04-04T04:24:14.410Z","avatar_url":"https://github.com/openmost.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Matomo for Nuxt\n\n[![npm version][npm-version-src]][npm-version-href]\n[![npm downloads][npm-downloads-src]][npm-downloads-href]\n[![License][license-src]][license-href]\n[![Nuxt][nuxt-src]][nuxt-href]\n\n- [✨ \u0026nbsp;Release Notes](/CHANGELOG.md)\n\n## Quick Setup\n\n1. Add `@openmost/nuxt-matomo` dependency to your project\n\n```bash\n# Using pnpm\npnpm add @openmost/nuxt-matomo\n\n# Using yarn\nyarn add @openmost/nuxt-matomo\n\n# Using npm\nnpm install @openmost/nuxt-matomo\n```\n\n2. Add `@openmost/nuxt-matomo` to the `modules` section of `nuxt.config.ts`\n\n```javascript\nexport default defineNuxtConfig({\n  modules: [\n    '@openmost/nuxt-matomo'\n  ]\n})\n```\n\n3. Register config in the `matomo` section to your `nuxt.config.ts`:\n\n```javascript\nruntimeConfig: {\n  public: {\n    matomo: {\n      host: 'https://matomo.example.com',\n      containerId: 'xxxxxxxx',\n    },\n  },\n}\n```\n\n4. You can override values with `.env` file:\n```\nNUXT_PUBLIC_MATOMO_HOST=https://matomo.example.com\nNUXT_PUBLIC_MATOMO_CONTAINER_ID=xxxxxxxx\n```\n\n5. Update your Matomo page view tag configuration\n\nAs [SPA doesn't work with Matomo Tag Manager](https://developer.matomo.org/guides/spa-tracking) by default, you have to add a second trigger to your Matomo tag in the Tag Manager UI.\n\n- Look at your Matomo Tag Manager container configuration\n- Edit Matomo Analytics tag, and add a new \"History change\" trigger.\n- Ensure that your tag has now both \"Page view\" AND \"History change\" triggers.\n- Don't forget to publish a new version of your container!\n\n## Default `dataLayer` on every pages\n\nOn every pages, the default `dataLayer` object is generated with this structure :\n\n```javascript\ndataLayer.push({\n  event: 'page_view',\n  page_url: '/', //example value\n  referrer_url: '/previous' //example value\n})\n```\n\n## Useful composables\n\nThis module allow you to use some helpful composables, here is the list :\n\n### Add data to your `dataLayer` with the `useDataLayerPush` composable\n\nThe `useDataLayerPush()` composable allow you to easely push data to the `dataLayer` array.\n\n```html\n\u003ctemplate\u003e\n  \u003cbutton @click=\"onClick\"\u003eClick me\u003c/button\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\nfunction onClick(){\n  useDataLayerPush({\n    event: 'some_event',\n    foo: 'bar',\n  })\n}\n\u003c/script\u003e\n```\n\n### Send events with the `useMatomoEvent` composable\n\nThe `useMatomoEvent()` composable allow you to send events to Matomo directly from your components.\n\nIt also handle custom dimension as 5th parameter (optional).\n\n```html\n\u003ctemplate\u003e\n  \u003cbutton @click=\"onClick\"\u003eClick me\u003c/button\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\nfunction onClick(){\n  useMatomoEvent('Category', 'Action', 'event_name', 23, {dimension1: 'Some value'})\n}\n\u003c/script\u003e\n```\n\n### Convert goals with the `useMatomoGoal` composable\n\nThe `useMatomoGoal()` composable allow you to convert goals from your components.\n\n```html\n\u003ctemplate\u003e\n  \u003cbutton @click=\"onClick\"\u003eClick me\u003c/button\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\nfunction onClick(){\n  useMatomoGoal(4) // 4 is the goal ID\n}\n\u003c/script\u003e\n```\n\n\n### Handle custom dimensions with the `useMatomoCustomDimension` composable\n\nThe `useMatomoCustomDimension()` composable allow you to send data to your custom dimensions.\n\n```html\n\n\u003ctemplate\u003e\n  \u003cbutton @click=\"onClick\"\u003eClick me\u003c/button\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\n  function onClick() {\n    useMatomoCustomDimension(1, 'My custom value') // 1 is the custom dimension ID\n  }\n\u003c/script\u003e\n```\n\n### Support custom variables with the `useMatomoCustomVariables` composable\n\nThe `useMatomoCustomVariables()` composable allow you to send data to your custom variables.\n\n```html\n\n\u003ctemplate\u003e\n  \u003cbutton @click=\"onClick\"\u003eClick me\u003c/button\u003e\n\u003c/template\u003e\n\n\u003cscript setup\u003e\n  function onClick() {\n    useMatomoCustomVariables(1, 'variable name', 'variable value', 'page') \n  }\n\u003c/script\u003e\n```\nEnjoy !\n\n\u003c!-- Badges --\u003e\n\n[npm-version-src]: https://img.shields.io/npm/v/@openmost/nuxt-matomo/latest.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n\n[npm-version-href]: https://npmjs.com/package/@openmost/nuxt-matomo\n\n[npm-downloads-src]: https://img.shields.io/npm/dm/@openmost/nuxt-matomo.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n\n[npm-downloads-href]: https://npmjs.com/package/@openmost/nuxt-matomo\n\n[license-src]: https://img.shields.io/npm/l/@openmost/nuxt-matomo.svg?style=flat\u0026colorA=18181B\u0026colorB=28CF8D\n\n[license-href]: https://npmjs.com/package/@openmost/nuxt-matomo\n\n[nuxt-src]: https://img.shields.io/badge/Nuxt-18181B?logo=nuxt.js\n\n[nuxt-href]: https://nuxt.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenmost%2Fnuxt-matomo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopenmost%2Fnuxt-matomo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopenmost%2Fnuxt-matomo/lists"}