GTM & contact form 7 - gtm.formSubmit not firing

2019-06-04 06:41发布

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:

enter image description here

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

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

1条回答
来,给爷笑一个
2楼-- · 2019-06-04 07:04

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.
enter image description here

查看更多
登录 后发表回答