开发者

Facebook Javascript API: tracking user adding application for first time

I can't seem to find the answer to a very simple question, I'm sure I'm missing something obvious.

My app is working fine (has been for months), it's a pretty straightforward app which uses strictly the javascript API (inside an iFrame). I currently need to implement some tracking which detects when new users add the application for the first time -- but I can't figure out how!

The docs are not helpful: http:/开发者_如何学运维/developers.facebook.com/docs/authentication/

The authentication is working fine, but there doesn't seem to be any information passed back that says "hey, this is this user's first visit" or "hey, this is a return visitor". What am I missing here? How can I track that? Is there a parameter?

Any advice would be greatly appreciated!


The most reliable way will be doing this on a server you own. You would log the user id (which will never change) and maybe the current date/time in a database table or some other form of storage. When the user logs in / authenticates with your Facebook app, call back to your server to log the user id if you haven't seen that user before. Other ways of tracking them the first time will be inconsistent because Facebook post-authorization callbacks dont always work (if they arent already deprecated) and looking at the auth token isn't reliable because if the user revokes permissions and re-authenticates, it would get counted twice.


After successful logged in, it returns to the page you mentioned, from there you can get the facebook userid from the facebook which is unique for users. You check them in database, if exists show them "Returned" else new visitor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜