SEO & AI·4 min read·

How do I connect Google Analytics 4 to my VeloCMS blog?

Add your GA4 Measurement ID in Admin → Settings → Analytics and VeloCMS injects the tracking script on all public pages — no code editing required.

To connect Google Analytics 4 to your VeloCMS blog, copy your GA4 Measurement ID (the G-XXXXXXXXXX code from your Google Analytics property settings), paste it into Admin → Settings → Analytics → Google Analytics Measurement ID, and click Save. VeloCMS injects the gtag.js script on all public pages automatically from that point forward — no template editing, no manual script tag insertion.

Where do I find my GA4 Measurement ID?

Log into analytics.google.com, select your property, and go to Admin (the gear icon in the lower-left) → Data Streams → click your web stream. The Measurement ID is displayed at the top right of the stream details panel and starts with G- followed by ten alphanumeric characters (for example G-ABCDE12345). If you haven't created a GA4 property yet, the Google Analytics help center has a step-by-step setup wizard — the only thing you need to provide is your blog's URL (yoursubdomain.velocms.org or your custom domain).

How does VeloCMS inject the tracking script?

VeloCMS uses Next.js's next/script component with strategy='afterInteractive' to load the GA4 script asynchronously after the page has rendered. This means the tracking script never blocks your page's First Contentful Paint or Largest Contentful Paint — it loads quietly in the background after your content is already visible. The implementation follows Google's recommended gtag.js setup exactly: a script tag loading gtag.js from googletagmanager.com followed by the initialization call with your Measurement ID.

Does the analytics script fire on admin pages?

No. VeloCMS deliberately excludes admin dashboard routes from the analytics script injection. Admin pages are behind authentication and including them in your GA4 data would inflate your session counts and skew your engagement metrics since your own editing sessions look nothing like a real reader visit. The tracking script only loads on public-facing routes: the homepage, post detail pages, tag archives, help center articles, and any custom pages you've built. This exclusion happens at the middleware level so it works consistently regardless of your browser or any ad-blocker settings.

What events does VeloCMS track automatically?

VeloCMS relies on GA4's Enhanced Measurement, which Google enables by default for all new properties. Enhanced Measurement automatically tracks page views, scroll depth (measuring 90% scroll as a deep-read signal), outbound link clicks, site search queries (if you have search enabled), and video engagement for YouTube embeds. You don't need to set up any custom events for these — they just work once the Measurement ID is connected. For more advanced tracking like reading time, paywall conversion events, or newsletter sign-up attribution, you'd configure custom events in Google Tag Manager, but that's a separate integration you'd add via the Head & Footer Code panel on the Business plan.

If your blog has European readers, adding GA4 without a consent mechanism may violate GDPR. VeloCMS's built-in cookie consent banner (enabled from Admin → Settings → Privacy → Cookie consent) blocks the analytics script until a reader accepts analytics cookies. Enable the consent banner before going live with GA4 if your audience includes EU residents.