In This Article, we will explain you how to setup Gravity form Conversion and Event Tracking for your Website
How to add event tracking in Gravity form?
Let’s Begain and See the Step by Step process of Event Tracking in Gravity form with Google Tag Manager
Step 1: Setup Google Tag Manager for your website. (If not already, please read this article about Google Tag Manager installation). If you are exiting account. Please log in to your GTM Account and select your website container.
Step 2: Create a new Tag by selecting “Custom HTML” and named it “Data Layer” and add below code exactly
<script type="text/javascript"> jQuery(document).ready(function() { jQuery(document).bind("gform_confirmation_loaded", function(event, formID) { window.dataLayer = window.dataLayer || []; window.dataLayer.push({ event: "formSubmission", formID: formID }); }); }); </script>
and trigger to fire this Tags on All pages and save the custom HTML with any name.
Step 2: We have to create a Trigger. Click on Trigger and Click on New Trigger option to create a new Trigger
Select Custom Event option in Trigger configuration and add “formSubmission” in Event Name section. Select some form option. Save the trigger with “Custom Event”Name.
Step 5: Create custom Variable and add below code only and save it with name of Custom variable and save the variable
Click on Variable options from Left navigation and create a user define Variable. In Variable Type, select Data Layer Variable. Add “formId” without quotes in Data Layer Variable Name. All other setting will remain unchanged and save the variable with any name.
Step 6: Create A new tag and select Google Analytics: GA4 Event and under that select Google Analytics GA4 Configuration(We have already setup this on first part of GA4 installation. You can watch the same on below link https://www.youtube.com/watch?v=Q-np00ab2WU)
Add an Event name “Lead Form” and select Trigger “Custom Event“. Save your Tag with any name you want.
Step 7: publish all the tags which is important to get all the tags live
Step: 8 : Test all your tags via Form Submission and using GTM Preview and Debug Mode