: Can I track form submissions through Google Tag Manager? I want to track form submissions on the website in Google analytics. I was considering to add the following code to the SUBMIT button,
I want to track form submissions on the website in Google analytics.
I was considering to add the following code to the SUBMIT button,
<input id=”contact-submit” class=”button” type=”submit” value=”Submit” onClick="ga('send', 'event', { eventCategory: 'requestinfo', eventAction: 'submit', eventLabel: 'undergrad'});">
But can I do all of this through Google tag Manager to improve efficiency?
More posts by @Megan663
1 Comments
Sorted by latest first Latest Oldest Best
There are many ways so it really depends on what you are trying to accomplish. Below are a few options that will work on contact forms and any other type of click action.
1) You can setup a link trigger in GTM with HTML5 data parameter and class or ID
<input id=”contact-submit” class=”button” type=”submit” value=”Submit" data-form="Contact Us" data-whichpage="Home Page">
In GTM, fire on gtm.linkClick and use element ID -> equals -> contact-submit
2) If you have a confirmation page you can setup a dataLayer and use custom dimension to capture the information.
On your confirmation page setup a data layer using PHP or something:
dataLayer.push({
"Form_Name": "Home Page",
"Form_Type": "Contact Us",
"Custom_Dimention_2": "Parameter 2"
});
Then in GA create the custom dimentions and match them up with corresponding fields in GTM
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.