How to Add Google Analytics to Ghost (2026 Step-by-Step Guide)
Ghost has a Code Injection panel built into every site that injects HTML into the <head> and <footer> of every published page. Pasting the GA4 global site tag into the head injection field is the supported path on both Ghost(Pro) and self-hosted Ghost - takes about 5 minutes.
What you'll need before you start
- •A Ghost site (Ghost(Pro) any plan, or self-hosted Ghost)
- •Owner or Administrator account
- •A Google account
How to add Google Analytics on Ghost: Step-by-step
- 1
Create a GA4 property and Web data stream
Go to analytics.google.com, click Admin → Create → Property, and add a Web data stream pointing at your Ghost URL. After creation, click View tag instructions → Install manually to reveal the global site tag (the
<script>snippet starting withhttps://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX). Copy the entire snippet. - 2
Open Ghost's Code Injection settings
Sign in to Ghost Admin (e.g.,
yourdomain.com/ghost). In the sidebar click Settings → Advanced → Code injection. (On older Ghost versions: Settings → Code injection.) - 3
Paste the global site tag into Site Header
In the Site Header field, paste the entire GA4
<script>block you copied. Click Save. The tag will inject into the<head>of every page on your site - including post pages, the homepage, tag pages, and member-only pages. - 4
Optionally add member-aware tracking
Ghost exposes the current member via
window.ghost.memberon member-aware pages. To track logged-in vs anonymous visitors as a custom GA4 dimension, paste an additional small script after the gtag snippet that sets auser_propertiesfield. Example:<script> if (window.ghost && window.ghost.member) { gtag('set', 'user_properties', { membership_status: window.ghost.member.status || 'free' }); } </script>Skip this step if you don't use Ghost's membership features.
- 5
Verify the tag is firing
Open your Ghost site in an incognito window. Browse to a post. Within 30-60 seconds, GA4 → Reports → Realtime should show one active user. The Google Tag Assistant Chrome extension is a fast way to confirm the
G-XXXXXXXXXXID is firing on every page.
How to verify your setup is working
Open your Ghost site in an incognito window and read a post for at least 30 seconds. Then open GA4 → Reports → Realtime. You should appear as one active user. To confirm the tag is on every page (not just the homepage), navigate between a post, the homepage, and a tag archive page - all three should be reflected in the Realtime Top pages tile.
Common issues and fixes
The tag isn't firing on member-only or paywalled posts
Code Injection runs on every published page, including paywalled posts - the script tag is in the <head> before any paywall logic. If GA4 isn't firing on those posts, the issue is more likely that the post is set to members-only visibility and the visitor hasn't signed in. Test in an incognito window with member access to a free-tier post.
I'm self-hosting Ghost and the script is being stripped
Some self-hosting reverse proxies (Cloudflare with strict HTML rewriting, certain caching configurations) can strip inline scripts. Open your live page source (Ctrl+U / Cmd+U) and search for G-XXXXXXXXXX. If the snippet isn't there, the issue is upstream of Ghost. Check your CDN/cache rules or HTML minifier.
I want to track newsletter clicks/opens in Google Analytics
Ghost's newsletter system uses Mailgun for delivery and tracks opens/clicks in Ghost itself, not in Google Analytics. For UTM-tagged links in your newsletter, GA4 will pick those up as referral traffic when readers click through to your site - no extra config needed. Just add ?utm_source=newsletter&utm_medium=email&utm_campaign=YOUR_CAMPAIGN to links inside posts.
Frequently asked questions
Does Ghost have built-in analytics?
Ghost has minimal built-in analytics - it shows post views, member sign-ups, and a basic engagement chart in the dashboard. For traffic source attribution, search keywords, audience demographics, or anything beyond raw post views, you'll need Google Analytics or another third-party tool.
Can I add Google Analytics to a free Ghost(Pro) trial?
Yes. The Code Injection panel is available on every Ghost(Pro) plan, including the 14-day free trial. The trial publishes to a .ghost.io subdomain by default - that works for testing, but the GA4 data stream URL needs to match it.
Where do I paste the Google Analytics tag in Ghost?
Settings → Advanced → Code injection → Site Header. The Site Header field injects into <head>, which is where Google's snippet should go.
Can I use Google Tag Manager on Ghost instead?
Yes - paste the GTM container snippet (instead of the GA4 snippet) into Code Injection's Site Header field, plus the no-script fallback into the Site Footer field. Then manage GA4 (and any other tags) inside GTM. This is the cleaner setup if you'll add several tracking tools over time.
Will Google Analytics work on Ghost membership and paid subscription pages?
Yes. The tag fires on every page Ghost publishes, including member sign-up, sign-in, and account pages. To track membership conversions specifically, you can fire a custom GA4 event when window.ghost.member changes from null to a member object - that runs on the post-signup redirect page.
Does Google Analytics affect Ghost's site speed?
The GA4 script is small (~70KB) and loads asynchronously. On a typical Ghost site with otherwise lean code, the impact on Lighthouse performance scores is minimal - usually under 5 points. If you're chasing perfect Core Web Vitals, consider deferring the script or using a server-side tagging setup.
Related Guides
Once you're set up, MeasureBoard turns the data into action
MeasureBoard connects to your analytics, search, and SEO tooling and generates AI-powered weekly reports, GEO readiness scores, and a dedicated AI analyst that answers questions in plain English. Free to start, connects in 30 seconds.
Get Started Free