Google Tag Manager

⌘K
  1. Home
  2. Google Tag Manager
  3. Google Tag Manager Tracki...
  4. Track Form Submission via Thank You Page (GA4 Event via GTM)

Track Form Submission via Thank You Page (GA4 Event via GTM)

Objective:

Track successful form submissions for gated resources (e.g. eBooks, guides) by firing a generate_lead event when users land on the thank-you page, after submitting a form.

Scenario Summary:

  • A user visits a resource form page (e.g., /resource-name)
  • They fill in the form to download the resource
  • After submission, they are redirected to a thank-you page (e.g., /resource-name/thank-you)
  • You want to track the arrival on this thank-you page as a GA4 event

Step 1: Create a Page View Trigger for the Thank You Page

  1. In GTM, go to Triggers
  2. Click New
  3. Name your trigger: Page View – Resource Thank You
  4. Trigger Configuration → Select Page View
  5. Choose: Some Page Views
  6. Set condition: Page Path contains thank-you
    Or more specific: Page Path matches RegEx ^/resources/.*/thank-you$
  7. Click Save

Step 2: Create the GA4 Event Tag

  1. Go to Tags → Click New
  2. Name it: GA4 – generate_lead (Resource Download)
  3. Tag Configuration → Select Google Analytics: GA4 Event
  4. Under Configuration Tag, select your GA4 Config tag
  5. Event Name: generate_lead
  6. Add Event Parameters (optional but helpful for reporting):
    resource_name : {{Page Path}}

        form_type     : resource_form

       If you want more specific values like the actual resource title, you can create a Lookup Table variable based on URL or use DOM scraping.

Step 3: Connect the Trigger to the Tag

  1. In the tag configuration, scroll to Triggering
  2. Choose: Page View – Resource Thank You
  3. Click Save

Step 4: (Optional) Create a Lookup Table for Resource Name

  1. Go to Variables → Click New
  2. Variable Type: Lookup Table
  3. Input Variable: Page Path
  4. Example mapping:
InputOutput
/ebooks/seoSEO Guide
/ebooks/seo/thank-youSEO Guide
/whitepapers/adsAds Whitepaper
/whitepapers/ads/thank-youAds Whitepaper
  1. Output Variable Name: resource_name
  2. Use this variable in the GA4 tag’s parameters

Step 5: Test in Preview Mode

  1. Click Preview in GTM
  2. Enter your resource form page URL → Click Connect
  3. Fill in the form and submit
  4. When you’re redirected to /thank-you, check if:
    • Page View – Resource Thank You fires
    • GA4 tag generate_lead fires
    • Parameters like resource_name are captured

Step 6: Publish Your GTM Changes

  1. Click Submit → Publish
  2. Name the version: GA4 Event – Resource Download Tracking

Result

Every time a user submits a resource form and lands on the thank-you page, a GA4 event named generate_lead will be triggered, allowing you to:

  • Attribute leads to specific content offers
  • Measure the effectiveness of resource downloads
  • Build audiences or conversions in GA4

How can we help?