mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-21 07:16:15 -04:00
feat: added plausible tracker
This commit is contained in:
parent
3f038503dd
commit
0808920951
5 changed files with 36 additions and 0 deletions
|
@ -2,6 +2,7 @@ import { createApp } from 'vue';
|
|||
import { createPinia } from 'pinia';
|
||||
import { createHead } from '@vueuse/head';
|
||||
import { registerSW } from 'virtual:pwa-register';
|
||||
import { plausible } from './plugins/plausible.plugin';
|
||||
|
||||
registerSW();
|
||||
|
||||
|
@ -16,5 +17,6 @@ app.use(createPinia());
|
|||
app.use(createHead());
|
||||
app.use(router);
|
||||
app.use(naive);
|
||||
app.use(plausible);
|
||||
|
||||
app.mount('#app');
|
||||
|
|
17
src/plugins/plausible.plugin.ts
Normal file
17
src/plugins/plausible.plugin.ts
Normal file
|
@ -0,0 +1,17 @@
|
|||
import Plausible, { type PlausibleOptions } from 'plausible-tracker';
|
||||
import type { App } from 'vue';
|
||||
|
||||
const options: PlausibleOptions = {
|
||||
domain: import.meta.env.VITE_PLAUSIBLE_DOMAIN ,
|
||||
apiHost: import.meta.env.VITE_PLAUSIBLE_API_HOST,
|
||||
trackLocalhost: false,
|
||||
};
|
||||
|
||||
export const plausible = {
|
||||
install: (app: App) => {
|
||||
const plausible = Plausible(options);
|
||||
plausible.enableAutoPageviews();
|
||||
|
||||
app.config.globalProperties.$plausible = plausible;
|
||||
},
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue