点击通过FB共享对话框进行跟踪? [英] How do you do clickthrough tracking via the FB Share Dialog?

查看:136
本文介绍了点击通过FB共享对话框进行跟踪?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据Facebook关于共享对话的文档,您可以使用Javascript触发打开共享对话框,以便用户可以共享您传递的任何URL:

According to Facebook's documentation for the Share Dialog, you can use Javascript to trigger open a share dialog so that the user can share whatever URL you pass in:

FB.ui({
  method: 'share',
  href: 'https://developers.facebook.com/docs?myTrackingParam=topShareButton',
}, function(response){});

但是,如果您要通过将查询字符串附加到 href 属性被剥离,因为FB在抓取URL时使用 og:url 元标记。我使用查询参数来跟踪哪个共享按钮导致最多的流量。所以我的问题:你如何通过FB共享对话框进行点击跟踪?有一种方法可以在共享时在URL中设置一些查询字符串值?

However, if you want to do any referral tracking by appending a query string to the href property gets stripped, since the FB uses the og:url meta tag when it crawls the URL. I use the query params to track which share buttons are causing the most traffic. So my question: how can you do clickthrough tracking via the FB Share Dialog? Is there a way to set some query string value in the URL when sharing?

推荐答案

经过一些实验和拼接分开的FB文档您可以设置在 fb_ref 查询参数。但是,这需要我们把这个份额转换成一个开放式图表调用。

After some experimentation and piecing together separate FB docs, you can indeed set whatever value that gets passed back in the fb_ref query param. However, this requires us to turn the share into an Open Graph call.

所以,而不是使用 share 方法我们可以使用 share_open_graph 方法。因此,我们可以设置 action_properties ,其中包括 ref 属性:

So instead of using the share method, we could use the share_open_graph method. Thus, we can set the action_properties, which would include the ref property:

FB.ui({
  method: 'share_open_graph',
  action_type: 'og.shares',
  action_properties: JSON.stringify({
      object:'https://developers.facebook.com/docs',
      ref: 'topShareButton'
  })
}, function(response){});

因此,新闻稿/时间轴上显示的链接将为 https ://developers.facebook.com/docs fb_ref = topShareButton 。现在你可以做任何追踪你心中的事情!

Thus, the link that is shown on the Newsfeed/Timeline will be https://developers.facebook.com/docs?fb_ref=topShareButton. And now you can do whatever tracking your heart desires!

这篇关于点击通过FB共享对话框进行跟踪?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆