To ensure that form submission events from Gravity Forms are tracked, you’ll need to add a custom HTML code snippet to the confirmation settings of the form. This custom script will push relevant data into the DataLayer, which can then be captured by your GTM setup.
Here’s how to set up the tracking:
1. Open Gravity Forms Dashboard:
Navigate to your WordPress dashboard and select the Gravity Forms plugin to open the list of available forms.
2. Locate the Form:
Click on ‘Forms’ in the main dashboard.
Select the form you wish to track by clicking on its title.
Once in the form editor, click on ‘Settings’ and then select ‘Confirmations’.
3. Edit the Confirmation Text:
In the Confirmation settings, you’ll typically see the confirmation type set to “Text”.
Switch the text editor to “Text” mode (instead of “Visual”) to enter the code without any formatting issues.
4. Add DataLayer Push Code:
In the Text editor, enter the following JavaScript code:
<script>
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
‘event’: ‘formSubmission’
});
</script>