mirror of
https://github.com/CorentinTh/it-tools.git
synced 2025-04-20 06:55:06 -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
env.d.ts
vendored
2
env.d.ts
vendored
|
@ -2,6 +2,8 @@
|
||||||
/// <reference types="vite-svg-loader" />
|
/// <reference types="vite-svg-loader" />
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
|
VITE_PLAUSIBLE_API_HOST: string;
|
||||||
|
VITE_PLAUSIBLE_DOMAIN: string;
|
||||||
PACKAGE_VERSION: string;
|
PACKAGE_VERSION: string;
|
||||||
PROD: boolean;
|
PROD: boolean;
|
||||||
}
|
}
|
||||||
|
|
14
package-lock.json
generated
14
package-lock.json
generated
|
@ -22,6 +22,7 @@
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"naive-ui": "^2.28.0",
|
"naive-ui": "^2.28.0",
|
||||||
"pinia": "^2.0.11",
|
"pinia": "^2.0.11",
|
||||||
|
"plausible-tracker": "^0.3.5",
|
||||||
"qrcode": "^1.5.0",
|
"qrcode": "^1.5.0",
|
||||||
"randombytes": "^2.1.0",
|
"randombytes": "^2.1.0",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
|
@ -8187,6 +8188,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/plausible-tracker": {
|
||||||
|
"version": "0.3.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/plausible-tracker/-/plausible-tracker-0.3.5.tgz",
|
||||||
|
"integrity": "sha512-6c6VPdPtI9KmIsfr8zLBViIDMt369eeaNA1J8JrAmAtrpSkeJWvjwcJ+cLn7gVJn5AtQWC8NgSEee2d/5RNytA==",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/pngjs": {
|
"node_modules/pngjs": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
||||||
|
@ -16898,6 +16907,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"plausible-tracker": {
|
||||||
|
"version": "0.3.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/plausible-tracker/-/plausible-tracker-0.3.5.tgz",
|
||||||
|
"integrity": "sha512-6c6VPdPtI9KmIsfr8zLBViIDMt369eeaNA1J8JrAmAtrpSkeJWvjwcJ+cLn7gVJn5AtQWC8NgSEee2d/5RNytA=="
|
||||||
|
},
|
||||||
"pngjs": {
|
"pngjs": {
|
||||||
"version": "5.0.0",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/pngjs/-/pngjs-5.0.0.tgz",
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
"lodash": "^4.17.21",
|
"lodash": "^4.17.21",
|
||||||
"naive-ui": "^2.28.0",
|
"naive-ui": "^2.28.0",
|
||||||
"pinia": "^2.0.11",
|
"pinia": "^2.0.11",
|
||||||
|
"plausible-tracker": "^0.3.5",
|
||||||
"qrcode": "^1.5.0",
|
"qrcode": "^1.5.0",
|
||||||
"randombytes": "^2.1.0",
|
"randombytes": "^2.1.0",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { createApp } from 'vue';
|
||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
import { createHead } from '@vueuse/head';
|
import { createHead } from '@vueuse/head';
|
||||||
import { registerSW } from 'virtual:pwa-register';
|
import { registerSW } from 'virtual:pwa-register';
|
||||||
|
import { plausible } from './plugins/plausible.plugin';
|
||||||
|
|
||||||
registerSW();
|
registerSW();
|
||||||
|
|
||||||
|
@ -16,5 +17,6 @@ app.use(createPinia());
|
||||||
app.use(createHead());
|
app.use(createHead());
|
||||||
app.use(router);
|
app.use(router);
|
||||||
app.use(naive);
|
app.use(naive);
|
||||||
|
app.use(plausible);
|
||||||
|
|
||||||
app.mount('#app');
|
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