Skip this if you don't use Ghost's membership features."},{"@type":"HowToStep","position":6,"name":"Add a tag in GTM and submit","text":"In tagmanager.google.com, click Tags → New . For GA4: Google Analytics: GA4 Configuration , paste Measurement ID, trigger All Pages , save. Click Submit in the top-right to publish."},{"@type":"HowToStep","position":7,"name":"Verify with GTM Preview","text":"Click Preview in GTM, paste your Ghost URL, click Connect. The debug overlay should show your container loaded. If you added the member-aware snippet, you should also see a member_state event in the data layer panel."}],"datePublished":"2026-04-27","dateModified":"2026-04-27"}
All How-To Guides
Ghost5 min·7 steps

How to Install Google Tag Manager on Ghost (2026 Step-by-Step Guide)

Ghost makes GTM installation easy: the Code Injection panel accepts both the head <script> and the body <noscript> snippets directly. The whole setup takes about 5 minutes. Ghost's clean structure also makes it a great platform for member-aware tag firing - you can use the window.ghost.member object to differentiate logged-in vs anonymous traffic.

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 install Google Tag Manager on Ghost: Step-by-step

  1. 1

    Create a GTM container

    Go to tagmanager.google.com, sign in, click Create Account, fill in the details, choose Web. Copy both install snippets - the <script> for <head> and the <noscript> for <body>.

  2. 2

    Open Ghost's Code Injection panel

    Sign in to Ghost Admin (e.g., yourdomain.com/ghost). Click SettingsAdvancedCode injection. (Older Ghost: SettingsCode injection.)

  3. 3

    Paste the head snippet into Site Header

    Paste the GTM <script> block (the longer one) into the Site Header field. Click Save.

  4. 4

    Paste the noscript snippet into Site Footer

    Ghost's Site Footer field injects right before </body>, which is acceptable for the <noscript> block. Paste the <noscript> block here. Click Save. (The "correct" placement is immediately after <body>, but Ghost doesn't expose that exact insertion point. End-of-body works fine - <noscript> only fires for users with JavaScript disabled, a tiny fraction of traffic.)

  5. 5

    (Optional) Add member-aware data-layer events

    Ghost exposes the current member via window.ghost.member on member-aware pages. To push membership state into dataLayer for GTM, add this small snippet to Site Header right after the GTM script:

    <script>
      window.dataLayer = window.dataLayer || [];
      if (window.ghost && window.ghost.member) {
        dataLayer.push({
          event: 'member_state',
          membership_status: window.ghost.member.status || 'free',
          membership_tier: window.ghost.member.tiers?.[0]?.slug || null
        });
      } else {
        dataLayer.push({ event: 'member_state', membership_status: 'anonymous' });
      }
    </script>

    Skip this if you don't use Ghost's membership features.

  6. 6

    Add a tag in GTM and submit

    In tagmanager.google.com, click TagsNew. For GA4: Google Analytics: GA4 Configuration, paste Measurement ID, trigger All Pages, save. Click Submit in the top-right to publish.

  7. 7

    Verify with GTM Preview

    Click Preview in GTM, paste your Ghost URL, click Connect. The debug overlay should show your container loaded. If you added the member-aware snippet, you should also see a member_state event in the data layer panel.

How to verify your setup is working

GTM Preview is the cleanest verification. The Google Tag Assistant Chrome extension confirms your GTM-XXXXXXX container is loading on each page. If GA4 is configured in the container, GA4 Realtime should show your test session within 30-60 seconds.

Common issues and fixes

GTM Preview can't connect to my Ghost site

If you're using Cloudflare in front of Ghost with strict HTML rewriting or aggressive caching, the GTM snippet could be stripped or stale. View your live site source - if GTM-XXXXXXX isn't in the <head>, the issue is upstream of Ghost. Clear CDN cache and check HTML rewriting rules.

I want to track newsletter signups in GTM

Ghost's signup form fires a member_signup event on the client when a user subscribes. Capture it in GTM with a Custom Event trigger matching that name, then forward to GA4 / your destinations as needed. Make sure your data layer push for member state runs after sign-up so the membership tier is correctly captured downstream.

Member-only pages aren't showing data layer events

The window.ghost.member object is only populated on pages rendered through Ghost's member-aware portal. If you're testing on a static page (e.g., a published blog post that doesn't load the portal), window.ghost may be undefined. The conditional check in the snippet handles this gracefully (it falls through to the anonymous case), but if you need member state on non-portal pages, you'll have to fetch it via Ghost's Members API.

Frequently asked questions

Does Ghost support Google Tag Manager?

Yes - through Ghost's Code Injection panel, which lets you paste both GTM snippets (head and body/footer) site-wide. Available on every Ghost(Pro) plan and on self-hosted Ghost. The setup is the same regardless of hosting.

Where do I put the GTM noscript code on Ghost?

In Code Injection's Site Footer field. The technically-correct placement is immediately after the opening <body> tag, but Ghost doesn't expose that exact insertion point. End-of-body via Site Footer works fine - <noscript> only fires for users with JavaScript disabled.

Can I track Ghost membership tiers with GTM?

Yes. Ghost exposes window.ghost.member on member-aware pages with the current member's status and tier. Push this into dataLayer via a small snippet right after the GTM script (example in step 5 above). Then create GA4 user-properties or custom dimensions in GTM that consume membership_status and membership_tier from the data layer.

Should I use GTM or Ghost's built-in Google Analytics field?

Ghost doesn't have a native Google Analytics field - the recommended path for GA on Ghost is via Code Injection. Use GTM if you'll add multiple tags (Meta Pixel, LinkedIn Insight, etc.) - it's cleaner than pasting each separately. Use the direct GA4 snippet if you only need GA4.

Will GTM work on Ghost member-only and paywalled posts?

Yes. Code Injection runs on every published page, including paywalled and members-only posts. Behavior on those pages depends on the visitor's authentication state - the GTM script always loads, but member-aware data layer events only fire when window.ghost.member is populated.

How do I know Google Tag Manager is working on my Ghost site?

Use GTM's Preview mode - paste your Ghost URL and click Connect. The debug overlay shows every tag, trigger, and data layer event in real time. The Google Tag Assistant Chrome extension is faster for confirming the container ID is loading on each page.

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