Lesson 13 of 17
Form Submission
① Connect your GTM container
Paste your container ID to load it into this page. It only ever runs here.
Advanced: use a specific environment
A form submission is one of the most valuable things you can measure, it is the moment a visitor becomes a lead. The trouble is timing: a real form often navigates to a thank-you page the instant it submits, and the browser can tear down the page before any tag has a chance to send its hit.
The reliable approach is to push a dedicated event the moment the submit succeeds and catch it with a Custom Event trigger. This form pushes form_submit with the form's id, name and destination, which you map into a GA4 generate_lead tag.
Goal
Fire a GA4 generate_lead tag when the form_submit event is pushed.
Build it in GTM
Know what the page pushes
On submit the page runsdataLayer.push({ event: "form_submit", form_id, form_name, form_destination }). GTM sees the eventform_submitand the three form fields alongside it.Create the Custom Event trigger
Go to Triggers → New and choose Custom Event. Set Event name toform_submit, matching the pushed string exactly.Fire a GA4
generate_leadtagCreate a GA4 Event tag, set its Event Name togenerate_lead(GA4's recommended lead event), and map the form details in as parameters. Set theform_submittrigger as its firing trigger. If you are just wiring the trigger, a Custom HTML tag namedCustom HTML - Testcontaining<script></script>stands in.
Debug in Tag Assistant
Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.
- In your GTM, click Preview.
- Paste the live URL above and click Connect.
- Interact with the live page and watch your tag fire in Tag Assistant.
What you should expect to see
form_submit event appears in the left rail, and your generate_lead tag shows under Tags Fired for it, carrying the form id, name and destination.Verify your container
Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.
Drop your container .json here
or browse · checked in your browser, nothing is uploaded