开发者

How to check if user is still using Facebook application

I have a Facebook application and I need to know everytime a 开发者_StackOverflow社区user stops using it (closed the browser, logged out from facebook, moved to another page, etc)

Anyway of doing this?? I'm using PHP and Graph Api

Thanks!


The most common way to do something like this is to keep track of the user's last access to one of your pages, and classify them as "offline" if no access has occurred in the last x minutes. If you really need to, you can do continuous ajax calls to your server to keep the status updated. That way you can know pretty quickly if a user closes the page or navigates away.

I have never tried it, but you could also experiment with making an ajax call in the page's unload event handler. But even that wouldn't catch everything that should probably count as "leaving" the app. That's why the "no action in x minutes" approach is generally used, it has lag but it catches everything including the user just walking away from the computer.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜