-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need a disabled option for local development #81
Comments
Sorry I have had little time lately. Such a feature does not yet exist, but I think it is a good feature. |
At the moment i do this as a workaround: index.js Vue.use(VueMatomo, {
requireConsent: true
}); App.vue created(){
if (process.env.NODE_ENV === 'production') {
this.$matomo.rememberConsentGiven();
}
} but would be awesome to just disable the tracking and not use a other feature as a workaround |
Hi, you can setup URLs and "Only track visits... from URLs..." in Matomo website settings. I ended up on this issue as I was looking for a way to disable tracking based on specific parameters, such as http://mywebsite.com/?optout=1 |
You can enable it only when you are in production like this : if (process.env.NODE_ENV === "production") {
Vue.use(VueMatomo);
} |
This is what I ended up doing: import App from "@/App.vue";
import { router } from "@/router";
import { createApp, type Plugin } from "vue";
import VueMatomo from "vue-matomo";
// Config from Vite .env file(s)
const siteId = import.meta.env.VITE_MATOMO_SITE_ID;
const hostDomain = import.meta.env.VITE_MATOMO_HOST;
// Wrapper plugin
const matomoPlugin: Plugin = {
install(app) {
if (!hostDomain || !siteId) {
// eslint-disable-next-line no-console
console.warn("Matomo did not load because options are missing.");
return;
}
app.use(VueMatomo, {
host: `//${hostDomain}`,
siteId: siteId,
router: router,
});
},
};
createApp(App)
.use(router)
.use(matomoPlugin)
.mount("#app"); And of course you can change the |
While i develop locally i create a lot of traffic. In vue-gtag there is option for it:
https://matteogabriele.gitbooks.io/vue-analytics/content/docs/turn-off-development.html
Is there anything similar in vue-matomo?
The text was updated successfully, but these errors were encountered: