Google Tag Manager (GTM) is a tool that manages the tracking codes on your website in one place without editing site code. Setup ends once you create a container and add two code snippets to your site. Google's help page says to paste the first snippet as high as possible in the head tag and the second snippet right after the opening body tag. To connect GA4 (Google Analytics 4), you also need to create one more Google tag and publish it. After publishing, data collection can take up to 30 minutes to start. This is based on Google's help pages checked on October 5, 2026.
Google Tag Manager is a tag management tool built from tags, triggers and variables
A tag is one piece of tracking code that runs on your site. Google's help page says you can configure and deploy tags for Google products and third parties with Google Tag Manager. You add the GTM code to your site once, and after that you create and change tags in the management screen.

The structure has two layers. An account represents an organization such as a company, and you create one container per website or app. Inside a container, three elements work together.
| Element | What it does | Example |
|---|---|---|
| Tag | Code that runs when an event occurs. It needs at least one trigger. | A Google tag that sends data to GA4 |
| Trigger | Detects events such as page views, clicks and form submissions and fires the tag. | Initialization - All Pages |
| Variable | A value used in a trigger's filter conditions. | Fire only when the page URL contains /products/ |
The GTM installation has two stages: create a container, then add the code
Installation splits into creating an account and container, then adding the code to your site. You need permission to edit the site code. If you use a CMS, the GTM integration feature of that service is easier than pasting code as described below. Google also says that website builders such as Wix, Shopify and WordPress can install GTM through their integration features.

- Sign in to tagmanager.google.com with your Google account. Under Create Account, enter an account name and country.
- For the container name, use the top-level URL if it is a website (for example www.example.com). Choose Web as the container type, click Create, and accept the Terms of Service. You can choose from Web, iOS, Android, AMP and Server.
- Open the container, find the container ID that starts with GTM on the Workspace tab, and open the code snippet.
- Paste the first snippet (a snippet is a piece of code you paste into a web page) as high as possible in the head tag (the document header area). Paste the second snippet right after the opening body tag (the page content area). The second snippet also contains a noscript version for when JavaScript does not run.
- Enter your site address and use the Test button to check that the installation is detected.
The success criterion for this stage is that the test detects the installation. You have not created any tag inside GTM yet, so no data is sent to GA4.
Connect GA4 in GTM with a Google tag that uses your measurement ID
Connecting GA4 means copying the Google tag ID of your GA4 property and registering it in GTM as a Google tag. First, in GA4, go to Admin > Data streams, select the stream, and copy the measurement ID from the stream details. It is the value that starts with G-, and you need Editor permission or higher on the property to see it.
Back in GTM, click New under Tags, choose Google tag as the tag type, and enter the value you just copied in the Tag ID field. For the trigger, choose Initialization - All Pages. Initialization is a trigger type designed to fire before all other triggers except the consent initialization trigger. Google notes that if you do not set the trigger correctly, the Google tag may not fire before other tags.
There are four page-view style triggers. Page View fires as soon as the browser starts loading. DOM Ready fires after the HTML structure is complete. Window Loaded fires after images and scripts have all loaded. For tags that read an element on the page into a variable, Google's help page tells you to use the DOM Ready type.
You add events such as button clicks or form submissions in the same way. When you create the tag, enter the measurement ID and an event name (for example signup_newsletter). Then define the condition for the event in the trigger, using a value such as the button label. You can pick an event name that Google has predefined or create your own.
Preview and publish in GTM, then check the data in GA4
Settings you save in GTM do not apply to your site until you publish them. So the order is three steps: check with Preview, publish, then confirm the data in GA4.

- Click Preview at the top right of the workspace, enter your site URL and connect. The Tag Assistant debug screen shows which tags fired and what data is passed. Look for the Google tag in the list of fired tags.
- Click Submit at the top right and choose Publish and Create Version. Enter a version name and description, then publish. At this point, read the workspace changes list once to check it matches what you intended.
- In GA4, open DebugView from the Admin menu or use the Realtime report, and check that your own visit event appears. DebugView shows events from the last 60 seconds by the second and the last 30 minutes by the minute.
If no events show in DebugView, check your cookie consent settings first. Google's help page explains that in consent mode, events do not appear in debug mode if the user has not consented to analytics cookies. This is the case when the tag fires in Preview but the event is missing in GA4.
These are the most common mistakes when installing GTM
- Finishing without publishing: workspace changes apply to the website only after you publish them through Submit. Do not stop after passing Preview.
- Attaching a trigger other than Initialization to the Google tag: Google's help page says to use the Initialization - All Pages trigger.
- Deleting the setup because there is no data right after publishing: Google says data collection can take up to 30 minutes to start. Do not change the setup during that time. Wait.
- Adding only one snippet: you need to add code in both the head and the body, and you should confirm detection with the install test.
- Thinking you cannot undo a wrong publish: a version is a snapshot of the container configuration at the time it was saved, so you can set an earlier version as the latest version to roll back.
Update (October 12, 2026): GTM containers can send data directly to Google measurement products
The Google Tag Manager release notes added container optimization on October 12, 2026. Before, GTM loaded one extra gtag.js script to send data to Google products. An optimized container sends data directly without that script. Google says this improves site speed and data collection, and lets you manage settings and user access permissions in one place, the container. The relationship between destination tags and tags becomes clearer, so diagnostic results are also consistent.
This change is not applied automatically. You start it yourself by following the container optimization guide. Your existing event tags and triggers stay as they are. If you built your container by following the installation steps in this article, check it in this order.
- On the GTM overview page, click Review details in the optimization banner. You can also click Get started in the Google destinations section of the settings page, on any row where the Optimized column shows No.
- Use the change preview to see what changes will come into the workspace, then click Add to workspace. If your Google tags have different settings from each other, first choose which tags to merge into one.
- Use Preview mode to confirm the tags fire normally, then Submit and publish. If something goes wrong, you can discard the workspace changes, or roll back to an earlier version if you have already published.
The success criterion is that the Google tag fires in Preview as before, and that your own visit event keeps appearing in GA4 DebugView or the Realtime report after publishing. Permissions are not saved in a version, so check them separately under external account links in the container admin settings.
The October 8 entry in the same release notes is also worth a look. All GTM container snippets are now initialized on load, and the gtag('config') command appears in the dataLayer as a gtag.config event. If your container uses a wildcard custom event trigger, tags may fire unexpectedly, so check in Preview.
Google Tag Manager frequently asked questions
What is the difference between Google Tag Manager and GA4?
GA4 is a tool that analyzes the events it collects, and GTM is a tool to configure and deploy tags. The two connect when you enter the GA4 measurement ID in GTM's Google tag.
Do I need to add the code by hand on a CMS such as WordPress?
Not necessarily. Google's help page says that using the integration feature of a website builder means you do not need to edit the code on every page.
Do I need a separate container for each site?
Yes. According to Google's help page, you create one container per website or app.
You have three things to do now. Copy the measurement ID (G-) from GA4, create a Google tag in GTM with the Initialization - All Pages trigger, then check it in Preview, publish, and confirm that your own visit event shows in GA4 DebugView.
Found this useful? Share it
Latest posts
Kakao Share Thumbnail Not Showing? Here's the Fix (JavaScript SDK 2025)
Learn why Kakao Share thumbnails don't appear even with a valid imageUrl, and fix it using scrapImage to convert your URL into a KAGE CDN URL. Step-by-step guide.
How to Generate CRM User Manuals in 20 Minutes with Claude Code Sub-Agents
Learn how Claude Code sub-agents can analyze your CRM codebase and auto-generate user manuals and visual guidebooks in just 20 minutes. See the real-world results.
GEO Generative Engine Optimization: The Complete 2025 AI Marketing Strategy Guide
Learn what GEO (Generative Engine Optimization) is, how it differs from traditional SEO, and discover 5 proven AI marketing strategies to get cited by AI search engines in 2025.
Related projects
Get new posts by email
Insights on marketing, analytics, and dev, delivered to your inbox.

