Set a Trigger for a Specific Form
Setting up a trigger in Google Tag Manager (GTM) for a specific form on your website is crucial for accurate data collection and analysis. By configuring a Form Submission trigger, you can monitor when users submit a particular form, providing valuable insights into user interactions and conversions. This guide will walk you through the process of establishing a trigger for a specific form, enabling you to gather targeted and reliable data for your analytical needs.
Enable Built-In Variables
Create a New Trigger
Configure the Trigger
Optional Trigger Settings
Test the Trigger
Important Considerations
Let’s get started 🚀
To effectively track form submissions, you'll need to enable the necessary built-in variables in GTM. These variables help capture detailed information about the form, such as the form's ID, classes, and URL.
In this step, we’ll enable the form-related variables that are crucial for configuring your trigger.
Once the built-in variables are enabled, it’s time to create a new trigger for your form. This step involves defining the conditions under which the form submission will trigger an event, allowing you to track it accurately.
We'll show you how to create and name your new trigger for a specific form on your website.
After creating the trigger, you’ll need to configure it to target the form you want to track. This involves setting conditions, such as the page URL and form ID, to ensure that only the intended form submissions are captured.
Example: To target a form with a specific ID on a particular page:
✅ Set the first condition to: Page URL equals https://www.example.com/target-page
✅ Add a second condition: Form ID equals [specific-form-id]
Let’s set up the conditions to make sure the trigger works for your specific form.
✅ Wait for Tags:** Enable this option and specify a delay (in milliseconds) to ensure that all tags have sufficient time to fire before the form submission proceeds. This is useful if the form redirects quickly after submission.
✅ Check Validation: Enable this to ensure the trigger fires only on successful form submissions. If disabled, the trigger may fire even if the form submission fails.
Testing your form submission trigger is essential to ensure that it works correctly before deploying it. GTM’s Preview mode allows you to simulate form submissions and verify if the associated tags fire as expected.
Let’s test the trigger and confirm that everything is set up properly.
✅ Ensure that the form on your website triggers a form_submit event. If it doesn't, the Form Submission trigger won't work. In such cases, consider using alternative triggers like Click Triggers or Element Visibility Triggers, depending on how the form operates.
✅ If the form doesn't reload the page upon submission (e.g., it shows a thank-you message without a page refresh), the Form Submission trigger might not detect the event. Alternative methods, such as custom event triggers, may be necessary.
Enable Built-In Variables
Create a New Trigger
Configure the Trigger
Optional Trigger Settings
Test the Trigger
Important Considerations
Let’s get started 🚀
Enable Built-In Variables
To effectively track form submissions, you'll need to enable the necessary built-in variables in GTM. These variables help capture detailed information about the form, such as the form's ID, classes, and URL.
In this step, we’ll enable the form-related variables that are crucial for configuring your trigger.
Create a New Trigger
Once the built-in variables are enabled, it’s time to create a new trigger for your form. This step involves defining the conditions under which the form submission will trigger an event, allowing you to track it accurately.
We'll show you how to create and name your new trigger for a specific form on your website.
Configure the Trigger
After creating the trigger, you’ll need to configure it to target the form you want to track. This involves setting conditions, such as the page URL and form ID, to ensure that only the intended form submissions are captured.
Example: To target a form with a specific ID on a particular page:
✅ Set the first condition to: Page URL equals https://www.example.com/target-page
✅ Add a second condition: Form ID equals [specific-form-id]
Let’s set up the conditions to make sure the trigger works for your specific form.
Optional Trigger Settings
✅ Wait for Tags:** Enable this option and specify a delay (in milliseconds) to ensure that all tags have sufficient time to fire before the form submission proceeds. This is useful if the form redirects quickly after submission.
✅ Check Validation: Enable this to ensure the trigger fires only on successful form submissions. If disabled, the trigger may fire even if the form submission fails.
Test the Trigger
Testing your form submission trigger is essential to ensure that it works correctly before deploying it. GTM’s Preview mode allows you to simulate form submissions and verify if the associated tags fire as expected.
Let’s test the trigger and confirm that everything is set up properly.
Important Considerations
✅ Ensure that the form on your website triggers a form_submit event. If it doesn't, the Form Submission trigger won't work. In such cases, consider using alternative triggers like Click Triggers or Element Visibility Triggers, depending on how the form operates.
✅ If the form doesn't reload the page upon submission (e.g., it shows a thank-you message without a page refresh), the Form Submission trigger might not detect the event. Alternative methods, such as custom event triggers, may be necessary.
Updated on: 13/01/2025
Thank you!