How do I install GA4 with Google Tag Manager?

Applies to: Google Analytics 4 (GA4)
Last updated: May 2025


Problem

You want to set up Google Analytics 4 on your website using Google Tag Manager (GTM) instead of manually inserting tracking code. This allows for more flexible, scalable tracking.


Solution

Use Google Tag Manager to deploy a GA4 Configuration tag with your Measurement ID, then publish the changes. GTM lets you manage analytics, marketing, and event tags in one place—without editing your website code directly.


Step-by-Step Guide

1. Set Up Google Tag Manager (if you haven’t already)

  • Go to https://tagmanager.google.com
  • Create an account and a container for your website
  • Add the GTM code snippet to every page of your site (in the <head> and just after <body>)
    • This only needs to be done once

2. Get Your GA4 Measurement ID

  1. Go to https://analytics.google.com
  2. Select your GA4 property
  3. Click Admin (⚙️) > Data Streams
  4. Click your Web stream
  5. Copy your Measurement ID (e.g., G-XXXXXXXXXX)

3. Create a GA4 Configuration Tag in GTM

  1. Open your GTM workspace
  2. Go to Tags > New
  3. Choose Tag Type: Google Analytics: GA4 Configuration
  4. Paste your Measurement ID
  5. Leave other options at default (you can enable enhanced measurement in GA4 separately)

4. Set the Trigger

  1. Click Triggering
  2. Choose All Pages – this ensures the tag fires on every page load
  3. Save the tag and name it something like “GA4 – Config – All Pages”

5. Publish the Container

  • Click Submit in GTM
  • Add a version name/description (optional)
  • Click Publish

6. Verify Tracking Works

  • Visit your site in a new tab
  • In GA4, go to Reports > Realtime
  • You should see yourself appear as an active user

Optional: Use Preview mode in GTM or the Google Tag Assistant Chrome extension to validate tag firing.


Notes

  • You only need one GA4 Configuration tag per website
  • You can add additional GA4 Event tags later to track clicks, form submissions, video plays, etc.
  • GTM gives you full control over event tracking without touching code again