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
- In GTM, go to Triggers
- Click New
- Name your trigger: Page View – Resource Thank You
- Trigger Configuration → Select Page View
- Choose: Some Page Views
- Set condition: Page Path contains thank-you
Or more specific: Page Path matches RegEx ^/resources/.*/thank-you$ - Click Save
Step 2: Create the GA4 Event Tag
- Go to Tags → Click New
- Name it: GA4 – generate_lead (Resource Download)
- Tag Configuration → Select Google Analytics: GA4 Event
- Under Configuration Tag, select your GA4 Config tag
- Event Name: generate_lead
- 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
- In the tag configuration, scroll to Triggering
- Choose: Page View – Resource Thank You
- Click Save
Step 4: (Optional) Create a Lookup Table for Resource Name
- Go to Variables → Click New
- Variable Type: Lookup Table
- Input Variable: Page Path
- Example mapping:
| Input | Output |
| /ebooks/seo | SEO Guide |
| /ebooks/seo/thank-you | SEO Guide |
| /whitepapers/ads | Ads Whitepaper |
| /whitepapers/ads/thank-you | Ads Whitepaper |
- Output Variable Name: resource_name
- Use this variable in the GA4 tag’s parameters
Step 5: Test in Preview Mode
- Click Preview in GTM
- Enter your resource form page URL → Click Connect
- Fill in the form and submit
- 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
- Click Submit → Publish
- 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