Lead Generation Sandbox

Track events. Analyze behavior.

Real-world interactions, real dataLayer pushes. Configure Google Tag Manager to capture these events and route them to GA4.

dataLayer.push()
dataLayer.push({  event: 'generate_lead',  lead_source: 'website_form',  form_id: 'contact_main',  lead_id: 'LEAD-1708234567',  value: 50.00,  currency: 'USD'});

Tasks #3–#4

Forms

A simple contact form and a multi-step flow. Both fire real POST requests to the backend — watch for [FETCH] logs in the console.

How to capture this in GTM
Goal
Track the full lead funnel: when a user starts a form, which fields they touch, and when they convert.
Events to catch
form_start form_field_interaction generate_lead
Trigger
Custom Event · event name = generate_lead
Tag
GA4 Event · event name = generate_lead. Add lead_source, form_id, value, currency as Event Parameters by mapping each one to a Data Layer Variable of the same name.
Verify
Open GTM Preview, paste this URL, fill the contact form, and submit. You should see the trigger fire and the tag send the event. In GA4 DebugView, generate_lead appears with all parameters within seconds.

Contact Form

Trainee Instructions: Click into the inputs below to trigger form_start and blur off them to catch form_field_interaction payloads. Submitting correctly pushes a generate_lead.

form_field_interaction: name
form_field_interaction: email

Multi-step form

Trainee Instructions: Proceed through the funnel. Each view fires form_step_view. Reaching the end yields a form_complete.

Task #5 — section_view

Features

Trainee Instructions: Scroll up and down. Each card below is tracked by an Intersection Observer. As soon as they enter your viewport, they push a section_view event to the data layer. Verify this in your console array.

GTM from scratch
Containers, tags, triggers, and variables. The fundamental mechanics.
GA4 events
Recommended event taxonomy, parameters, and custom dimensions.
Enhanced E-commerce
The complete purchase funnel in GA4 — from product views to refunds.
API Tracking
Monitor fetch requests, intercept REST responses, and fire events on external APIs.
Debugging
Preview Mode, DebugView, Network Tab — the full arsenal.
Attribution
UTM tags, source/medium logic, user properties, and attribution models.
Task #6 — video events

YouTube Player API

GTM can automatically track YouTube. Enable the 'YouTube Video' trigger to catch video_start, video_progress, and video_complete.

How to capture this in GTM
Goal
Track engagement with the embedded YouTube player without writing custom JavaScript.
Events to catch
video_start video_progress video_complete
Trigger
YouTube Video · Set Capture: Start, Progress (10/25/50/75), Complete. Filter to Video URL contains youtube.com.
Tag
GA4 Event tag, event name = video_start (and video_progress, video_complete on the corresponding triggers). Map Video Title and Video Percent built-in variables to event parameters.
Verify
GTM auto-injects the YouTube IFrame API listener. Press play, scrub past 25%, and watch the events stream in the console with [DL] prefix.
Task #7 — outbound_click

Outbound links

Trainee Instructions: Click the Outbound links below. We've hijacked the native behavior so it doesn't open instantly, allowing you to intercept the click, read its href, and push an outbound_click to GTM.

How to capture this in GTM
Goal
Catch every click that takes the user off your domain, so you can attribute outbound traffic correctly.
Events to catch
outbound_click
Trigger
Just Links · Wait for Tags = on, Check Validation = on, Click URL does not contain your hostname.
Tag
GA4 Event tag, event name = outbound_click. Pass Click URL, Click Text, and the link's hostname as parameters.
Verify
Click any external link in the Outbound section. The console logs outbound_click, GA4 DebugView shows the event, and the navigation still works because Wait for Tags is set.
Task #8 — newsletter_signup
How to capture this in GTM
Goal
Track newsletter conversions distinctly from general lead generation, so you can build a separate audience for email campaigns.
Events to catch
newsletter_signup
Trigger
Custom Event · event name = newsletter_signup
Tag
GA4 Event tag, event name = newsletter_signup. Pass form_id and email_provider as parameters.
Verify
Submit a valid email. The fetch request resolves 200, the dataLayer push fires, and GA4 DebugView shows newsletter_signup. Mark this as a conversion in GA4 Admin → Events.
Task #9 — callback_request
How to capture this in GTM
Goal
Catch the success state of an async POST request, not just the click that triggered it. This is the pattern for any form that calls an API.
Events to catch
callback_request api_success
Trigger
Custom Event · event name = api_success · Trigger Filter: request_path matches /api/callback
Tag
GA4 Event tag, event name = callback_request. Pass response_status, response_time_ms, and the masked phone number.
Verify
Submit the form. Open the Network tab, watch the POST to /api/callback, wait for 200, then see api_success in the console. The trigger only fires for matching paths, so other API calls won't pollute this tag.

Request a callback

Trainee Instructions: Entering a phone number here mocks an asynchronous POST request to the backend. Open the Network tab to watch the fetch request. Once 200 OK resolves, catch the api_success event.