跟踪来自Facebook的访问者 [英] Tracking visitors coming from Facebook

查看:255
本文介绍了跟踪来自Facebook的访问者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我工作的公司编写了一个基于PHP的博客。不使用任何框架。我无法跟踪从我的Facebook页面的帖子到我的博客(不是wordpress)的用户。



我创建了一个短链接网址。假设它是sample.co,它将流量重定向到sample.com。一切似乎很好,直到这里。问题从这里开始。



我正在添加所有用户的ip,用户代理。但是,如果即使我有500次访问,我的代码也会增加3000次访问。 Facebook的统计数据和分析显示类似的统计数据(约500次访问)。我看到,添加到MySQL的IP都是不同的。它通常发生在Android用户身上。我在某处看过,当FB显示帖子时,Facebook有时会向用户呈现实际的URL。我的意思是代替小部件,Facebook显示整个页面。为了解决这个问题,我创建并添加了一个jQuery脚本到我的页面,并监听用户的滚动事件。它效果很好。没有看到太多的流量。但是这一次问题是我计数较少的用户。即使我从Facebook和Google Analytics获得500个用户也显示类似的结果,但我的脚本仅为MySQL添加了200-300个。



有人知道更好的方式来跟踪真实流量吗?或者您是否知道这样的问题?



谢谢

找到了答案。这个问题被称为预览(prefetch)。这里是链接:



https: //www.facebook.com/business/help/1514372351922333



简单地说,当FB向访问者显示缩略图以加快页面的速度时,facebook会预加载所有内容加载速度。他们发送 X-Purpose:预览标题。因此,您可以简单地检查 HTTP_X_PURPOSE 标头的值是否为预览或不。如果是这样,不要把它算作一个访客。



以下是更详细的描述:

http://inchoo.net/dev-talk/mitigating -facebook-x-fb -http-engine-liger /

http://inchoo.net/dev-talk/magento-website-hammering-facebook-liger/


I have written a PHP based blog for the company i work for. Not using any frameworks. I am having trouble tracking users who come from my facebook page's posts to my blog (not wordpress).

I have created a shortlink url. Let's say it is sample.co and it redirects traffic to sample.com. Everything seems fine until here. The problem starts here.

I am adding all user's ip's, user agents. But if even i get 500 visits, my code adds somethig like 3.000 visits. Facebook stats and Analytics shows similar stats (~500 visits). I see that ip's added to MySQL are all different. It usually happens with Android users. I have read somewhere that Facebook sometimes renders to their users the actual URL when FB shows the post. I mean instead of the widget, Facebook shows the whole page. I am not quite sure about that to be honest.

To solve this problem, I have created and added an jquery script to my page and listened users' scroll event. It worked great. Not seeing too much traffic. But this time the problem is i am counting less users. Even I get 500 users from facebook and Analytics shows similar results, my script adds only 200-300 to MySQL.

Does anyone know a better way to track real traffic? Or do you aware of such problem?

Thanks

解决方案

I have found the answer. The problem is called preview (prefetch). Here is the link:

https://www.facebook.com/business/help/1514372351922333

Simply, facebook preloads everything when FB shows the thumbnail to the visitor to speed up your page's load speed. They send X-Purpose: preview header. So you can simply check if HTTP_X_PURPOSE header's value is preview or not. If so, do not count it as a visitor.!

Here are more detailed descriptions:

http://inchoo.net/dev-talk/mitigating-facebook-x-fb-http-engine-liger/

http://inchoo.net/dev-talk/magento-website-hammering-facebook-liger/

这篇关于跟踪来自Facebook的访问者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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