Skip to Content
InstallationGoogle Tag Manager

Google Tag Manager Installation

Install Ghost Metrics using Google Tag Manager (GTM).

Prerequisites

Before you begin, make sure you have:

  • A Google Tag Manager account with access to publish changes
  • Your Ghost Metrics tracking code from the dashboard
  • GTM container already installed on your website

Step 1: Open Your GTM Container

  1. Go to tagmanager.google.com 
  2. Select your account and container
  3. Make sure you’re in the correct workspace

Step 2: Create a New Tag

  1. Click Tags in the left sidebar
  2. Click New to create a new tag
  3. Name your tag “Ghost Metrics” (or something descriptive)

Step 3: Configure the Tag

  1. Click Tag Configuration
  2. Select Custom HTML from the tag type list
  3. Paste your Ghost Metrics tracking code:
<!-- Ghost Metrics Tag Manager --> <script> var _mtm = window._mtm = window._mtm || []; _mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'}); (function() { var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.async=true; g.src='https://example.ghostmetrics.cloud/js/container_XXXXXXXX.js'; s.parentNode.insertBefore(g,s); })(); </script> <!-- End Ghost Metrics Tag Manager -->

Replace example.ghostmetrics.cloud and container_XXXXXXXX.js with the values from your Ghost Metrics dashboard.

Step 4: Set Your Trigger

  1. Click Triggering below the tag configuration
  2. Select All Pages (or “Initialization - All Pages” for earliest loading)
  3. Click Save

Which Trigger to Use?

  • All Pages — Standard choice, fires when the page loads
  • Initialization - All Pages — Fires before other tags, useful if you have many GTM tags

Step 5: Preview and Test

Before publishing:

  1. Click Preview in the top right
  2. Enter your website URL
  3. Navigate through your site in the preview window
  4. Verify the Ghost Metrics tag fires on each page

You should see your “Ghost Metrics” tag listed as “Fired” in the GTM debug panel.

Step 6: Publish

Once you’ve confirmed the tag is firing:

  1. Click Submit in the top right
  2. Add a version name (e.g., “Added Ghost Metrics tracking”)
  3. Click Publish

Verify in Ghost Metrics

After publishing:

  1. Visit your website
  2. Open Ghost Metrics and go to VisitorsReal-time
  3. You should see your visit appear within seconds

Event Tracking with GTM

You can send custom events to Ghost Metrics via the GTM data layer. Push events like this:

dataLayer.push({ 'event': 'ghost_metrics_event', 'eventCategory': 'Form', 'eventAction': 'Submit', 'eventLabel': 'Contact Form' });

Then create a GTM tag that listens for this event and sends it to Ghost Metrics. Contact support if you need help configuring custom event tracking through GTM.

Troubleshooting

Tag Not Firing

  • Check that your trigger is set to “All Pages”
  • Verify the container is published (not just in preview mode)
  • Clear your browser cache and try again

Data Not Appearing in Ghost Metrics

  • Confirm the tracking code has the correct domain and container ID
  • Check for JavaScript errors in your browser’s developer console
  • Verify your GTM container is installed on the website

Next Steps

Last updated on