analytics: consolidate everything onto one shared Plausible pa- script
All pcbjam properties now load the same new-format Plausible script (https://plausible.io/js/pa-KjNS9YmidydULZTstsjRg.js — one dashboard, segment by hostname) instead of per-domain data-domain sites: - site: replace Vercel Analytics with the pa- snippet in BaseLayout (is:inline, prod-only, crossorigin="anonymous" for the COEP require-corp routes in vercel.json); drop @vercel/analytics dep. Legal pages (cookies/privacy) rewritten Vercel -> Plausible. - standalone: initAnalytics() rewritten for the new script format (queue shim + plausible.init(), async, no data-domain). The gate is now VITE_PLAUSIBLE_SRC (script URL, deploy-time opt-in) — unset means no tracking, so dev checkouts and third-party GPL builds stay clean. VITE_PLAUSIBLE_DOMAIN is gone. - deploy: build-demo/build-editor --plausible now takes the script URL; release.yml/deploy-demo.yml hardcode the (public) pa- URL, so the repo Actions variable PLAUSIBLE_DOMAIN is no longer used. Verified: standalone tsc + vite build (pa- URL present with env, absent without, crossOrigin kept); astro build has the snippet on all layout pages and no vercel/insights references; astro dev stays untracked. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
ac64799187
commit
40b53ad530
14 changed files with 116 additions and 95 deletions
|
|
@ -31,7 +31,7 @@ function parseArgs(argv) {
|
|||
// cross-posts to <landing>/api/waitlist unless --waitlist overrides it.
|
||||
landing: "https://pcbjam.com",
|
||||
waitlist: null,
|
||||
// Plausible analytics data-domain. Off unless given (or VITE_PLAUSIBLE_DOMAIN
|
||||
// Plausible pa-*.js script URL. Off unless given (or VITE_PLAUSIBLE_SRC
|
||||
// is already in the environment, which passes straight through).
|
||||
plausible: null,
|
||||
};
|
||||
|
|
@ -126,7 +126,7 @@ function main() {
|
|||
VITE_LANDING_URL: a.landing,
|
||||
VITE_WAITLIST_URL: a.waitlist,
|
||||
// Plausible analytics: explicit --plausible wins, else any env-provided value.
|
||||
...(a.plausible ? { VITE_PLAUSIBLE_DOMAIN: a.plausible } : {}),
|
||||
...(a.plausible ? { VITE_PLAUSIBLE_SRC: a.plausible } : {}),
|
||||
};
|
||||
|
||||
console.log(`build-demo: tag=${a.tag} cdn=${a.cdn}`);
|
||||
|
|
@ -137,7 +137,7 @@ function main() {
|
|||
console.log(` VITE_LIBS_SOURCE=${env.VITE_LIBS_SOURCE}${env.VITE_LIBS_MANIFEST_URL ? ` (${env.VITE_LIBS_MANIFEST_URL})` : ""}`);
|
||||
console.log(` VITE_MODELS_MANIFEST_URL=${env.VITE_MODELS_MANIFEST_URL ?? "(unset — 3D models off)"}`);
|
||||
console.log(` VITE_LANDING_URL=${env.VITE_LANDING_URL} VITE_WAITLIST_URL=${env.VITE_WAITLIST_URL}`);
|
||||
console.log(` VITE_PLAUSIBLE_DOMAIN=${env.VITE_PLAUSIBLE_DOMAIN || "(off)"}`);
|
||||
console.log(` VITE_PLAUSIBLE_SRC=${env.VITE_PLAUSIBLE_SRC || "(off)"}`);
|
||||
|
||||
// Keep the dev-only WASM symlink out of the bundle (it'd copy 100s of MB into
|
||||
// dist/; the CDN serves it). In CI it isn't present, so this is a no-op there.
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ function main() {
|
|||
VITE_APP_TAG: a.tag,
|
||||
VITE_GIT_SHA: gitSha(repoRoot),
|
||||
VITE_REPO_URL: a.repo,
|
||||
...(a.plausible ? { VITE_PLAUSIBLE_DOMAIN: a.plausible } : {}),
|
||||
...(a.plausible ? { VITE_PLAUSIBLE_SRC: a.plausible } : {}),
|
||||
};
|
||||
|
||||
console.log(`build-editor: tag=${a.tag} api=${a.apiBase} cdn=${a.cdn}`);
|
||||
|
|
@ -114,7 +114,7 @@ function main() {
|
|||
console.log(` VITE_LIBS_SOURCE=${env.VITE_LIBS_SOURCE}`);
|
||||
console.log(` VITE_MODELS_MANIFEST_URL=${env.VITE_MODELS_MANIFEST_URL ?? "(unset — 3D models off)"}`);
|
||||
console.log(` VITE_APP_TAG=${env.VITE_APP_TAG} VITE_GIT_SHA=${env.VITE_GIT_SHA || "(none)"}`);
|
||||
console.log(` VITE_PLAUSIBLE_DOMAIN=${env.VITE_PLAUSIBLE_DOMAIN || "(off)"}`);
|
||||
console.log(` VITE_PLAUSIBLE_SRC=${env.VITE_PLAUSIBLE_SRC || "(off)"}`);
|
||||
|
||||
// Keep the dev-only WASM symlink out of the bundle (CDN serves it).
|
||||
const hadWasm = existsSync(publicWasm) || isSymlink(publicWasm);
|
||||
|
|
|
|||
Loading…
Reference in a new issue