pickstack

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 --yes
Customize in the configurator

Packages it adds

PackageVersionType
@plausible-analytics/tracker^0.4.7runtime

New files

.env.example
VITE_PLAUSIBLE_DOMAIN=
src/analytics.ts
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

src/main.ts (changed)
 import { createApp } from "vue"; import App from "./App.vue";+import { initAnalytics } from "./analytics"; import "./assets/main.css";  +initAnalytics();+  createApp(App).mount("#app");  

Project files

Related templates