【问题标题】:Facebook Tracking Pixel On a Button EventFacebook 跟踪按钮事件上的像素
【发布时间】:2018-06-21 11:31:23
【问题描述】:

我正在尝试在我的网站上设置一个 facebook 跟踪像素。我需要在提交联系表格时触发像素。我的联系表单在提交时不会重定向到新页面,因此我需要将像素放置到“在线操作跟踪事件”。

这是 facebook 给我的 sn-p:

<button id="submitButton">Generate lead</button>
<script type="text/javascript">
    $('#$submitButton').click(function() {
      insert_event_code_here;
      ...
</script>

这是我当前的按钮脚本:

<form role="form" method="post" id="contactForm">
    <!-- my form fields -->
    <div class="col-md-12">
        <button type="button" id="submit" name="submit" class="btn btn-primary pull-right control-submit">Send!</button>
    </div>

当用户点击发送消息按钮时,我如何将这两段代码拼接在一起以触发一个工作的 facebook 像素?

另外,Facebook 代码显示“insert_event_code_here;”的地方是什么?

非常感谢大家!

【问题讨论】:

  • “另外,Facebook 代码显示“insert_event_code_here;”这是什么?” - 执行实际像素调用以跟踪事件的代码......?

标签: javascript html facebook


【解决方案1】:

如果您只是想跟踪按钮的点击,您可以使用https://developers.facebook.com/docs/marketing-api/audiences-api/pixel#inpageevents 的示例代码之类的内容触发事件

<form role="form" method="post" id="contactForm">

<!-- my form fields -->

<div class="col-md-12">

<button type="button" id="submit" name="submit" class="btn btn-primary pull-right control-submit" onclick="fbq('track', 'Purchase');">Send!</button>

</div>

【讨论】:

  • 你是明星!谢谢
  • 但是如何在这里添加最近需要的参数currencyvalue呢?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-15
  • 2016-05-14
  • 2020-08-29
  • 1970-01-01
  • 1970-01-01
  • 2015-08-31
相关资源
最近更新 更多