本文介绍了GTM&联系表格7-gtm.formSubmit不触发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在具有3个表单(wordpress的联系表单7)的单页网站上,当提交其中一种表单时,我向Google跟踪代码管理器发送了一个数据层事件:

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'});"

在GTM中,我创建了一个自定义事件触发器,该触发器将在收到事件"formSubmit"时触发.为了彼此分离这3种形式,并为每种形式使用sepearte标签,我使用该形式的ID过滤了触发器:

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:

现在,由于gtm.formSubmit未触发,因此事件触发器无法触发.我只是得到formSubmit事件,而没有gtm.FormSubmit.

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

有什么主意我可以为所有3种形式获得单独的触发条件吗?

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

推荐答案

要为每种表单获取不同的触发器,我现在对所有这些表单使用不同的dataLayer.push事件:

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'});"

因此,现在我不需要在GTM中过滤表单ID,我可以在这些事件之一触发时立即触发.效果很好,当正确提交联系表单7时会触发该事件,而单击提交"按钮时不会触发该事件.

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.

这篇关于GTM&联系表格7-gtm.formSubmit不触发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 20:48