angular - Facebook fbq ('track' 'lead' ) 在 Angular 4 中跟踪特定页面

标签 angular typescript facebook-pixel

我使用的是 Angular 4,我只是想检测用户完成表单的次数,直到成功注册页面。但在成功注册后我看不到/检测到任何东西。谁能告诉我我哪里出错了?这是我使用的方法:

成功页面.component.ts

constructor(public router: Router) {
  this.router.events.subscribe(event => {
    if (event instanceof NavigationEnd) {
      fbq('track', 'Lead');
    }
  });
}

index.html

<script>
  ! function(f, b, e, v, n, t, s) {
    if (f.fbq) return;
    n = f.fbq = function() {
      n.callMethod ?
        n.callMethod.apply(n, arguments) : n.queue.push(arguments)
    };
    if (!f._fbq) f._fbq = n;
    n.push = n;
    n.loaded = !0;
    n.version = '2.0';
    n.queue = [];
    t = b.createElement(e);
    t.async = !0;
    t.src = v;
    s = b.getElementsByTagName(e)[0];
    s.parentNode.insertBefore(t, s)
  }(window, document, 'script',
    'https://connect.facebook.net/en_US/fbevents.js');
  fbq('init', '256905991728678');
  fbq('track', 'PageView');
</script>

最佳答案

您只需使用 Facebook 脚本调用“Lead”事件即可。下面的 Facebook 脚本很好。现在你对fB脚本的调用是错误的。只需使用其他调用方法,以便在“lead”事件之上调用 FB 脚本。

关于angular - Facebook fbq ('track' 'lead' ) 在 Angular 4 中跟踪特定页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51355883/

相关文章:

javascript - 如何在 PrimeNG 中使用 RowGroup 交换组位置?

javascript - Angular 2 从外部数据引导应用程序

typescript - 如何在 TS 2.0 之后正确获取 Aurelia 的 TypeScript 类型定义文件 (*.d.ts)。发布?

vue.js - Facebook Pixel 与 Conversion API - 帮助跟踪相同的事件 ID

javascript - 使用 rails 和 turbolinks 运行 facebook pixel

javascript - 无法更新 Angular 版本

Angular 6 : How to hide radio circle using Angular Material and use NgStyle for checked answer?

angular - 标识符 'required' 未定义。 '__type' 不包含这样的成员

node.js - Sequelize 生成错误的查询? Sequelize 自动 ts 和 Sequelize

javascript - Facebook Pixel + Google 标签管理器 + fbq 事件