Wire Google Analytics 4 (G-V8QWB45G6X) alongside Umami
Adds gtag.js to the production head so Search Console can cross-reference
GA traffic. Same gating as Umami — production builds only, never injected
on dev. Three head entries:
1. Umami (kept) — self-hosted, DNT-aware, GDPR-light
2. Google's gtag loader (async)
3. Inline init: window.dataLayer + gtag('config', 'G-V8QWB45G6X')
Both analytics run side-by-side; pick one or both in the GA dashboard.
A GDPR consent banner is not added — configure IP anonymisation +
consent mode v2 in the GA property settings if you intend to serve EU
visitors without explicit cookie acceptance.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -128,9 +128,12 @@ export default defineConfig({
|
|||||||
title: 'Nibiru',
|
title: 'Nibiru',
|
||||||
description:
|
description:
|
||||||
'A modular MMVC PHP framework for rapid prototyping. Born among the old gods, built for modern builders.',
|
'A modular MMVC PHP framework for rapid prototyping. Born among the old gods, built for modern builders.',
|
||||||
// Umami analytics — self-hosted, cookie-free, honours Do-Not-Track.
|
// Analytics — production-only.
|
||||||
// No GDPR consent banner needed because no PII or cross-site state
|
// 1. Umami (self-hosted) — cookie-free, honours Do-Not-Track,
|
||||||
// is captured. The script is only injected on production builds.
|
// no PII captured, no GDPR banner required.
|
||||||
|
// 2. Google Analytics 4 (gtag.js) — added for Search Console
|
||||||
|
// cross-linking + audience reach. Subject to GDPR; configure
|
||||||
|
// consent / IP-anonymisation in the GA property settings.
|
||||||
head: import.meta.env.PROD
|
head: import.meta.env.PROD
|
||||||
? [
|
? [
|
||||||
{
|
{
|
||||||
@@ -143,6 +146,21 @@ export default defineConfig({
|
|||||||
'data-exclude-search': 'true',
|
'data-exclude-search': 'true',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
tag: 'script',
|
||||||
|
attrs: {
|
||||||
|
async: true,
|
||||||
|
src: 'https://www.googletagmanager.com/gtag/js?id=G-V8QWB45G6X',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tag: 'script',
|
||||||
|
content:
|
||||||
|
"window.dataLayer = window.dataLayer || [];\n" +
|
||||||
|
"function gtag(){dataLayer.push(arguments);}\n" +
|
||||||
|
"gtag('js', new Date());\n" +
|
||||||
|
"gtag('config', 'G-V8QWB45G6X');",
|
||||||
|
},
|
||||||
]
|
]
|
||||||
: [],
|
: [],
|
||||||
logo: {
|
logo: {
|
||||||
|
|||||||
Reference in New Issue
Block a user