{"id":28404041,"url":"https://github.com/simpleanalytics/vue-plugin","last_synced_at":"2025-06-27T11:31:32.888Z","repository":{"id":35008417,"uuid":"185829512","full_name":"simpleanalytics/vue-plugin","owner":"simpleanalytics","description":"Vue plugin for Simple Analytics","archived":false,"fork":false,"pushed_at":"2023-10-07T12:51:07.000Z","size":578,"stargazers_count":9,"open_issues_count":4,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-26T09:38:39.233Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/simple-analytics-vue","language":"JavaScript","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/simpleanalytics.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}},"created_at":"2019-05-09T15:53:09.000Z","updated_at":"2025-05-23T22:22:09.000Z","dependencies_parsed_at":"2024-06-21T04:29:48.713Z","dependency_job_id":null,"html_url":"https://github.com/simpleanalytics/vue-plugin","commit_stats":{"total_commits":60,"total_committers":10,"mean_commits":6.0,"dds":0.7166666666666667,"last_synced_commit":"52b4c86d128270f4917fb17f4fc6a3cad1c331a2"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/simpleanalytics/vue-plugin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpleanalytics%2Fvue-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpleanalytics%2Fvue-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpleanalytics%2Fvue-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpleanalytics%2Fvue-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simpleanalytics","download_url":"https://codeload.github.com/simpleanalytics/vue-plugin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpleanalytics%2Fvue-plugin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262152541,"owners_count":23267067,"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":[],"created_at":"2025-06-01T19:11:22.305Z","updated_at":"2025-06-27T11:31:32.877Z","avatar_url":"https://github.com/simpleanalytics.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://simpleanalytics.com/?ref=github.com/simpleanalytics/vue-plugin\"\u003e\n  \u003cimg src=\"https://assets.simpleanalytics.com/images/logos/logo-github-readme.png\" alt=\"Simple Analytics logo\" align=\"right\" height=\"62\" /\u003e\n\u003c/a\u003e\n\n# Vue plugin\n\n[Simple Analytics](https://www.simpleanalytics.com/) is a clean, simple, and privacy-first analytics tool. Actionable data in a beautiful dashboard. It does not use cookies and you can bypass ad-blockers. Make sure to signup to get the most value out of this plugin.\n\n## Install\n\nWe support Vue 3 and Vue 2.\n\n### Vue 3\n\nJust run this command to install Simple Analytics for Vue 3:\n\n```bash\nnpm install simple-analytics-vue@3.0.3 --save\n```\n\n### Vue 2\n\nIf you are using Vue 2, use version 2.x of this package. It will not get any updates. Install it with `npm install simple-analytics-vue@2.x --save`.\n\n## Import in app\n\nImport the plugin and add it to `Vue.use`. You can add a `skip` option which will define when page views should be skipped. This can be useful if you want to skip page views from yourself when developing your app.\n\n```js\nimport SimpleAnalytics from \"simple-analytics-vue\";\nimport Vue from \"vue\";\n\nVue.use(SimpleAnalytics, { skip: process.env.NODE_ENV !== \"production\" });\n```\n\nYou can also pass a function or promise to `skip` which will be validated before injecting the Simple Analytics embed code:\n\n```js\nimport auth from \"lib/auth\";\nVue.use(SimpleAnalytics, { skip: auth.isAdminPromise });\n```\n\nYou can also optionally specify a custom domain to bypass ad blockers. Read more about this in [our documentation](https://docs.simpleanalytics.com/bypass-ad-blockers).\n\n```js\nVue.use(SimpleAnalytics, { domain: \"api.example.com\" });\n```\n\n### Events\n\nTo send an event, inject the `saEvent` method into your Vue 3 setup script like so:\n\n```vue\n// ~/src/components/Comment.vue\n\n\u003cscript setup\u003e\nimport { inject } from \"vue\";\n\nconst saEvent = inject(\"saEvent\");\n\n// e.g.: send event when liking a comment\nconst likeComment = (comment) =\u003e {\n  saEvent(`comment_like_${comment.id}`);\n};\n\u003c/script\u003e\n```\n\n[Read more about the Vue `inject` method here.](https://vuejs.org/guide/components/provide-inject.html#inject)\n\n\u003e **Note: Simple Analytics does not run on localhost.**  \n\u003e You can still fire events, but they will be captured and logged in the console for debugging purposes.\n\n## Nuxt\n\nCreate a Nuxt client-side plugin like so:\n\n```js\n// ~/plugins/simple-analytics.client.js\n\nimport SimpleAnalytics from \"simple-analytics-vue\";\n\nexport default defineNuxtPlugin((nuxtApp) =\u003e {\n  nuxtApp.vueApp.use(SimpleAnalytics, {\n    skip: process.env.NODE_ENV !== \"production\",\n  });\n});\n```\n\n_If you need any additional configuration options (as the ones mentioned above), you just need to apply to your plugin._\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpleanalytics%2Fvue-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimpleanalytics%2Fvue-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpleanalytics%2Fvue-plugin/lists"}