Training Ground

GTM and GA4 with real data

Two sites connected to a real backend: a landing page with forms and API endpoints, plus a shop with a full e-commerce checkout flow. Everything's pushed to the dataLayer. Your job is to catch it.

30+
events in dataLayer
15
tasks from ★ to ★★★★
12
API endpoints
2
training sandboxes

Before you start

GTM in 90 seconds

If you've never set up tracking before, read this first. The four pieces below are everything GTM does.

01

Container

A small script you paste once on your site. It loads everything else: tags, triggers, variables. You manage it from tagmanager.google.com without touching code again.

Lives in <head> and <body>
02

dataLayer

A JavaScript array on every page. Your code pushes events into it (form submitted, item added to cart). GTM watches the array and reacts.

window.dataLayer.push({...})
03

Trigger

The condition that fires a tag. Most useful kind: Custom Event. Set the event name to the one your dataLayer pushes (e.g. generate_lead) and you're done.

Custom Event = generate_lead
04

Tag

What runs when a trigger fires. Send a GA4 event, fire a Meta pixel, ping a webhook — whatever you need. One trigger can fire many tags.

GA4 Event, Meta Pixel, etc.

The whole game: your code pushes to dataLayer → trigger spots the event → tag fires to GA4. Once that loop is in your head, the rest is just config.


Going one level deeper

How GTM actually works

The 90-second primer is the mental model. This is what's happening under the hood, and why GTM is built this way.

Think of GTM as a router sitting between your site and every analytics or ad platform you use. Without it, each platform needs its own snippet on every page, and every change ships through your dev team. With it, marketers configure tracking from a UI, dev gets out of the loop, and one event can fan out to ten destinations.

Here's the trick: GTM never invents data. It only routes what your site already broadcasts into the dataLayer. So the most important file in any tracking setup isn't the GTM container — it's the schema you push from your code. Get the schema right and GTM is mostly plumbing.

Practical loop you'll repeat all day: write a dataLayer.push that matches the GA4 schema, build a trigger that listens for it, attach a tag that forwards it. Verify in GTM Preview side-by-side with GA4 DebugView. That's it. Ten reps and you're a working analyst.

The data flow

click · submit · scroll

dataLayer.push

yes

no

User action

Your site code

dataLayer

GTM trigger
match?

Tag fires

Nothing

GA4

Meta Pixel

Webhook / CRM

Google's quick-start video

Six minutes from Google's own team. Watch it once before touching the sandboxes — it'll save you an hour of confusion later.


Sandboxes

Two sites. Two use cases.

Each is built for a specific set of problems. Start with the landing page, then tackle the shop.

Lead Generation

Landing

Lead gen sandbox: simple forms, multi-step forms, YouTube tracking, outbound links, promo banners, and newsletter signups. All wired up to real API responses.

form_submitmulti_contactnewsletter_signupvideo_start
E-Commerce

E-Commerce Shop

The complete funnel: catalog, product pages, cart, multi-step checkout, payment, confirmation, and refunds. Textbook GA4 e-commerce.

view_item_listview_itemadd_to_cartpurchase

How to actually run this

Setup in five steps

Do these once. Then start the tasks on the landing or shop sandbox.

01
Create a GTM container
Sign up at tagmanager.google.com → create a Web container → copy the snippet (looks like GTM-XXXXXXX ). Both sandbox sites already include placeholders for the snippet, so paste it once and refresh.
02
Create a test GA4 property
Open analytics.google.com. Create a property and grab the Measurement ID ( G-XXXXXXX ). You'll feed this into your GA4 Configuration tag in the next step.
03
Open the browser console
Hit F12 in the sandbox. Every dataLayer push gets logged with a [DL] prefix; every API call with [FETCH] . You can also type window.dataLayer to inspect the full array. This is your single source of truth for debugging.
04
Enable GTM Preview
In GTM, click Preview, paste the sandbox URL, and watch tags fire in real time as you click around the page. Side by side with the console, you can see exactly which dataLayer push triggered which tag. If a tag isn't firing, the trigger condition is wrong — fix it here before publishing.
05
Work through the tasks
Each task on the sandboxes maps to one or two GA4 events. Start with the Forms section on /training/landing, it's the gentlest. By the time you reach the e-commerce shop, you'll be writing tag configs from memory.