GTM & contact form 7 - gtm.formSubmit not firing

余生颓废 提交于 2019-12-08 08:57:01

问题


On a single-page website with 3 forms (contact form 7 from wordpress), when one of these forms is submitted, I send a data layer event to Google Tag Manager:

on_sent_ok: "dataLayer.push({'event':'formSubmit'});"

In GTM i created a custom event trigger which fires when it gets the event "formSubmit". To sepearte the 3 forms from each other and use a sepearte tag for every form i filter the trigger with the id of the form:

Now the event trigger cant trigger because gtm.formSubmit is not fireing. I just get the formSubmit event and no gtm.FormSubmit.

Any idea how i can get a separate trigger for all the 3 forms?


回答1:


To get a different trigger for every form i now use a different dataLayer.push event for all of these forms:

on_sent_ok: "dataLayer.push({'event':'form1Submit'});"
on_sent_ok: "dataLayer.push({'event':'form2Submit'});"
on_sent_ok: "dataLayer.push({'event':'form3Submit'});"

So now i dont need to filter the form id in GTM i can just trigger when one of these events is firing. This works perfectly, the event is firing when contact form 7 is submited correctly and its not triggering when the submit button is clicked.



来源:https://stackoverflow.com/questions/33957117/gtm-contact-form-7-gtm-formsubmit-not-firing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!