Most small business owners assume they're tracking their website because Google Analytics is installed, but without a proper Google Tag Manager setup, those tags often don't fire correctly. The reality is messier: if the tags aren't firing on the right pages, at the right moments, your campaign data is incomplete at best and completely wrong at worst. You're making budget decisions based on a broken signal.
Google Tag Manager fixes that. It acts as a container that lives on your site and controls every tracking tag from one centralized dashboard, so you don't need a developer every time you want to add a conversion pixel or change an event name. Before The Matador Group runs a single paid ad or organic campaign for a client, we build out this exact configuration. It's the tracking foundation that makes every other marketing decision trustworthy.
By the end of this guide, you'll have a live GTM container installed on your site, GA4 receiving data through it, custom events firing from the dataLayer, and everything verified in Preview before going live.
Creating your GTM account and container
Google Tag Manager is a tag management system that loads your tracking scripts through a single container snippet instead of scattering individual scripts across your codebase. Think of it as a control panel for every tag on your site. For most users already familiar with Google's interface, getting from zero to a container ID takes only a few minutes, though actual time varies depending on your account setup and how many sites you're managing.
What to fill in on the account setup form
Go to tagmanager.google.com and sign in with your Google account. Click Create Account in the upper left. Under Account Setup, enter your company name, select your country, and leave the anonymous benchmarking toggle at your preference. One important distinction before you proceed: an account is the top-level entity (your company), and a container sits inside it (your specific website). You'll have one account and potentially multiple containers if you manage multiple sites.
Configuring your container correctly
For the Container Name, use your domain, like example.com. Under platform, select Web for any standard business website. Click Create, accept the Terms of Service, and GTM immediately shows you two installation code snippets. Do not close this screen. You need both snippets in the next step, and they're easy to retrieve again later under Admin → Container settings, but keeping them open saves time.
Google Tag Manager Setup: Installing the container snippet
This is where many small business owners go wrong. Common mistakes include pasting only one snippet, putting it in the wrong place, or adding it only to the homepage. Any of those mistakes means GTM won't fire consistently, and your data will have gaps.
Where each snippet lives in your site's HTML
GTM provides two code blocks. The JavaScript snippet goes as high as possible inside the <head> tag. The <noscript> snippet goes immediately after the opening <body> tag. The noscript block is not optional, it's a fallback iframe that provides limited data capture for visitors whose browsers block JavaScript, per Google's official GTM guidance. Both snippets must appear on every page of your site, not just the homepage. Place them in the shared template or layout file that generates every page.
Before the GTM container snippet, it's also good practice to initialize the dataLayer in your page's <head> so any early pushes are available to the container when it loads:
window.dataLayer = window.dataLayer || [];
Adding GTM to WordPress, Shopify, and Wix
The installation method varies by platform, but the goal is the same: both snippets on every page, in the right locations. Here's how each one works.
- WordPress: The safest approach is a reputable GTM plugin (like GTM4WP) that accepts your container ID and handles snippet placement automatically. Check the plugin documentation to confirm it places both snippets correctly and doesn't conflict with other tracking tools. If you prefer manual installation, add the JavaScript snippet to
header.phpinside the<head>, and the noscript snippet immediately after<body>. Always use a child theme or a site-specific custom plugin, never the parent theme directly, so a theme update doesn't wipe your work. - Shopify: Go to Online Store → Themes → Edit code → Layout → theme.liquid. Paste the JavaScript snippet inside
<head>and the noscript snippet immediately after the opening<body>tag. Save changes on the live theme, not Shopify's theme preview mode, and note that theme edits don't automatically extend to checkout pages on all Shopify plans. - Wix: Use Wix's native GTM integration or custom code tool. Enter your container ID, set placements to head and body accordingly, and publish the site. Saving inside the Wix editor is not enough: you must hit Publish for the snippets to appear on the live site.
After installation, open your live site, view the page source, and search for your container ID (formatted like GTM-XXXXXXX). Confirm one <script> block appears in <head> and one <noscript> block appears immediately after <body>.
Google Tag Manager Setup: Connect GA4 to your container
With the container live on your site, the next job is routing data to GA4. This requires two tags: a Google tag that establishes the connection on every page, and a GA4 Event tag for specific interactions you want to track.
Finding your GA4 Measurement ID and creating the Google tag
In GA4, go to Admin → Data Streams → your Web stream. Copy the Measurement ID, which starts with G-. Back in GTM, go to Tags → New → Google tag, paste the ID into the Tag ID field, and set the trigger to Initialization, All Pages. The Initialization trigger runs during container initialization, which means tags using it load earlier than typical pageview or DOM-ready triggers, ensuring GA4 is ready before event tags try to send data. Save the tag.
Building your first GA4 event tag
Create a second tag: Tags → New → Google Analytics: GA4 Event. Enter an event name using lowercase letters and underscores, like form_submit or contact_form_complete. Google maintains a schema of recommended event names (like generate_lead and sign_up) with built-in GA4 report definitions, so check those before inventing a custom name. Add a Form Submission trigger, attach optional event parameters using GTM variables, and save. This tag fires every time a visitor submits a contact form and sends a named event to GA4.
Pushing custom events to GTM with dataLayer
Auto-detected clicks and form submissions cover the basics, but for anything more precise, you need the dataLayer. This is how your site communicates specific user actions to GTM in a structured, readable format.
Writing a dataLayer.push() call
The dataLayer.push() function sends an object to GTM the moment something happens on your site. The event key is what GTM listens for: it must match the trigger name exactly, including case. Here's a real-world example for a newsletter signup:
window.dataLayer.push({ event: 'newsletter_signup', form_name: 'footer_newsletter', form_location: 'footer' });
This code lives in your site's JavaScript, attached to whatever interaction triggers the event, like a form submit listener. It is not written inside GTM itself. The extra keys (form_name, form_location) are parameters that GTM can read and forward to GA4 as event data.
Creating the custom event trigger and reading dataLayer variables
Inside GTM, go to Triggers → New → Custom Event and enter the event name exactly as it appears in your push, in this case newsletter_signup. Then create Data Layer Variables to capture those parameters: Variables → New → Data Layer Variable, with the variable name matching the key from your push exactly (form_name, form_location). These variables are what make the pushed data usable: you map them as parameters in your GA4 Event tag, so the event arrives in GA4 with form_name and form_location attached rather than just a bare event name.
Testing your tags with GTM Preview and Tag Assistant
Never publish a GTM container without running it through Preview first. What looks correct in the GTM interface doesn't always behave correctly on the live site. GTM preview and debug mode lets you catch those gaps before they affect real visitor data.
Running a Preview session and reading the results
Click Preview in GTM, enter your site URL, and connect. Tag Assistant opens a debug session alongside your site. Perform the action you're tracking, then return to the Tag Assistant window and select the corresponding event from the timeline. The Tags panel shows three states: Tags Fired (the tag executed), Tags Not Fired (a trigger condition failed), and Tags Failed (an execution error occurred). If a tag appears under Tags Not Fired, click it and look for the red-X indicators next to trigger conditions. Those marks tell you exactly which condition evaluated false and why.
Verifying events in GA4 DebugView
Once Tag Assistant confirms the tag fires, open GA4 and go to Admin → DebugView. Perform the same interaction on your site. The event should appear within seconds, with its parameters listed below it. Standard GA4 reports can take longer to populate than real-time data, so DebugView is the only reliable way to validate tracking during setup. If the event appears in Tag Assistant but not in DebugView, double-check that the Measurement ID in your Google tag matches the data stream you're looking at in GA4.
Common GTM setup errors and how to fix them fast
Even careful setups produce errors. The good news is that most GTM problems fall into a small set of patterns, and each one has a clear diagnostic path.
Tag Assistant can't connect or no events appear in the timeline
If Tag Assistant fails to connect entirely, check four things in order: the URL you entered must be the final URL after any redirects, the container snippet must be present on that page, an ad blocker or browser extension may be interfering (test in a clean private window), and the container ID must match between GTM and your site. If Tag Assistant connects but the expected event never appears in the timeline, the dataLayer push isn't firing. Inspect your JavaScript for errors and confirm the event listener is attached to the right element. Then confirm the event name in the push matches the trigger in GTM exactly, character by character.
Preview works but the live site doesn't track
This is the most common GTM gotcha, and it has one cause: Preview tests the workspace draft, not the published container. Real visitors see the last version you submitted and published, not the configuration you've been editing. If tracking works in Preview but not for live visitors, go to Submit → Publish and Create Version, add a version name, and publish. Also check whether a caching plugin or CDN is serving a stale version of your page without the GTM snippet: after publishing, purge the site cache so visitors load the updated HTML with the container code in place.
Get your Google Tag Manager setup right from day one
The full workflow comes down to six steps: create the account and container, install both snippets across your site, connect GA4 with a Google tag and your first event tag, push custom events through the dataLayer for precision tracking, test everything in Preview and DebugView, then publish. That sequence gives you a tracking foundation you can trust before spending a dollar on ads.
At The Matador Group, we handle GTM configuration as part of our full-stack digital marketing services, including tag strategy, GA4 and dataLayer implementation, and ongoing audits to keep data accurate as your site evolves. If you'd rather focus on running your business than chasing down a misfiring trigger in Tag Assistant, get in touch with our team.
Want the numbers on your own account? Thirty minutes, free. We look at your accounts, your creative and your spend, and tell you the three things we’d change first - whether you hire us or not. And every client is covered by our No Bull Guarantee, including full access to your own ad accounts.
Book my free consultation
