【问题标题】:Is it possible to add tracking to Hubspot form submit button是否可以向 Hubspot 表单提交按钮添加跟踪
【发布时间】:2015-12-14 14:55:26
【问题描述】:

有谁知道是否可以将跟踪代码添加到 Hubspot 表单中的提交按钮中?我尝试使用onFormSubmit 属性添加跟踪代码,但我没有收到任何提交按钮点击的跟踪结果。也许我的代码格式不正确。?我在下面包含了我的代码以供参考。出于安全原因,我删除了门户和表单 ID。

谢谢!

<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
hbspt.forms.create({ 
css: '',
cssClass:'.hs-form fieldset {max-width: 100%;}',
portalId: '',
formId: '',
inlineMessage: '<iframe style="width:100%; height:800px;" scrolling="auto" src="URL goes here"></iframe>',
onFormSubmit: 'mmConversionTag(704048, this, "_self"); ga("send","event","button","click","product distributors")'
});
</script>

【问题讨论】:

    标签: javascript jquery forms google-analytics hubspot


    【解决方案1】:

    onFormSubmit 是一个回调,你应该将它包装在一个匿名函数中,而不是传递一个字符串:

     hbspt.forms.create({ 
        css: '',
        cssClass:'.hs-form fieldset {max-width: 100%;}',
        portalId: '',
        formId: '',
        inlineMessage: '<iframe style="width:100%; height:800px;" scrolling="auto" src="URL goes here"></iframe>',
        onFormSubmit: function(){
           mmConversionTag(704048, this, "_self");
           ga("send","event","button","click","product distributors");
        }
     });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多