Home › Forums › Quform WordPress › adding date from form to event for google tag manager
- This topic has 6 replies, 2 voices, and was last updated 1 month, 2 weeks ago by Ally.
- AuthorPosts
- August 29, 2024 at 1:57 pm #37315deranalogeParticipant
hi there,
i have found your code here:
jQuery(function ($) {
$(‘.quform-form-1’).on(‘quform:successStart’, function () { dataLayer.push({‘event’: ‘Contact Form’});
});
});how can i add data from the form to the gtm? i need to send some information i get in the form to gtm.
thanks for your help
August 30, 2024 at 10:51 am #37320AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
August 30, 2024 at 12:16 pm #37323deranalogeParticipanthi,
thanks for your answer. now it does work when submitting the form.
but i need to send two form fields also so i have more information about the content.so waht i need is to add some kind of this into it:
jQuery(function ($) {
$(‘.quform-form-1’).on(‘quform:successStart’, function ()
{ dataLayer.push({
‘event’: ‘Contact Form’
‘produkt_id’: ‘form_field22’,
‘produkt_name’: ‘form_field11’
});
});
});so my problem is how can i get the data that the user filled in the field to push it to gtm (see produkt_id and produkt_name)? form_field22 and form_field11.
i hope i was able to desscribe it. so i just need to know how to push the form field data 🙂
September 2, 2024 at 9:10 am #37325AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
September 2, 2024 at 11:58 am #37327deranalogeParticipanthi,
thank you for your answer. i now added this code and it seems to work:jQuery(function ($) { $('.quform-form-1').on('quform:successStart', function () { var produkt = $('.quform-field-1_20').val(); dataLayer.push({ 'event': 'formsuccess', 'produkt': produkt }); }); });
thank you again
- This reply was modified 3 months, 2 weeks ago by deranaloge.
November 6, 2024 at 2:51 pm #37526deranalogeParticipanthi, one more question,
can i add this piece of code for each form in the custom java script settings page?
(i know i have to change the fomr id and the form field)thanks again
November 7, 2024 at 12:14 pm #37529AllySupport StaffYou don't have permission to view this content. Please log in or register and then verify your purchases to gain access.
- AuthorPosts
- You must be logged in to reply to this topic.