Don't have one? Create one ↗
← All courses

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

  1. Know what the page pushes

    On submit the page runs dataLayer.push({ event: "form_submit", form_id, form_name, form_destination }). GTM sees the event form_submit and the three form fields alongside it.
  2. Create the Custom Event trigger

    Go to Triggers → New and choose Custom Event. Set Event name to form_submit, matching the pushed string exactly.
  3. Fire a GA4 generate_lead tag

    Create a GA4 Event tag, set its Event Name to generate_lead (GA4's recommended lead event), and map the form details in as parameters. Set the form_submit trigger as its firing trigger. If you are just wiring the trigger, a Custom HTML tag named Custom HTML - Test containing <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.

  1. In your GTM, click Preview.
  2. Paste the live URL above and click Connect.
  3. Interact with the live page and watch your tag fire in Tag Assistant.

What you should expect to see

Submit the form on the live page. In Tag Assistant a 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

0 of 17 lessons complete