How to add Google Analytics 4 with Google Tag Manager
Install GA4 through Google Tag Manager: add a Google tag with your G- ID, fire it on all pages, preview, publish, and send signup events from the data layer.
With Google Tag Manager, add GA4 as a Google tag: create a new tag of that type, enter your Measurement ID (G-…), set it to fire on Initialization – All Pages, then preview and Submit to publish. Don't also paste the gtag code on your site, or visits are counted twice.
Before you start
You need a GTM container installed on your site (the two snippets from tagmanager.google.com, one in <head>, one after <body>), and your GA4 Measurement ID. Create GA4.
Add the Google tag
In Tag Manager, open your container and choose Tags → New.
Choose Tag configuration → Google Tag, and enter your Measurement ID as the Tag ID.
Choose Triggering → Initialization – All Pages.
Name it "GA4 – Google tag" and Save.
Choose Preview, open your site in the Tag Assistant window and check the tag fires. Then choose Submit → Publish.
Send a signup event
When signup succeeds, push an event to the data layer from your site:
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ event: "sign_up", method: "Email" });In GTM, create a Custom Event trigger with event name sign_up, and a Google Analytics: GA4 Event tag with event name sign_up that fires on it. Publish, then mark sign_up as a key event.
Check it works
After publishing, open your site and GA4's Realtime overview. More ways to check.
Sources
Last updated
Plain HTML
Add GA4 to a static HTML site by pasting the Google tag into the head of every page. Includes the exact code, where it goes, and how to check it works.
Key events
Key events are GA4's new name for conversions. What they are, how to mark an event as a key event in a minute, and the counting setting most people miss.