Vue + Plausible
Lightweight, cookie-free analytics with Plausible; it counts client-side navigations itself. This page shows exactly what pickstack adds to a Vue project for Plausible: the packages, the new files and the changes to existing ones. Every combination is installed, built, linted and tested in CI.
$ npm create pickstack@latest my-app -- --framework vue --modules plausible --yesCustomize in the configurator
Packages it adds
| Package | Version | Type |
|---|---|---|
@plausible-analytics/tracker | ^0.4.7 | runtime |
New files
VITE_PLAUSIBLE_DOMAIN=
import { init } from "@plausible-analytics/tracker";
/** Plausible; off until the site's domain is set (see .env.example). Call it once. */
export function initAnalytics() {
const domain = import.meta.env.VITE_PLAUSIBLE_DOMAIN;
if (!domain) return;
init({ domain });
}
Changes to existing files
import { createApp } from "vue"; import App from "./App.vue";+import { initAnalytics } from "./analytics"; import "./assets/main.css"; +initAnalytics();+ createApp(App).mount("#app");
Project files
.env.example.gitignoreREADME.mdenv.d.tsindex.htmlpackage.jsonsrc/App.vuesrc/analytics.tssrc/assets/main.csssrc/components/CounterCard.vuesrc/main.tstsconfig.app.jsontsconfig.jsontsconfig.node.jsonvite.config.ts