如何使用 Facebook OpenGraph 实现客户个性化?
我目前正在将 OpenGraph 集成到一家餐厅业务中。提供的代码/脚本在暂存环境中似乎运行良好,但我想更进一步:当一个人访问该网站并登录到 Facebook 时,我想为他们显示一条特定消息。
假设他们的名字是史蒂文史密斯,我想在网站顶部添加一个部分,其中写着“欢迎史蒂文,您想做什么?”,并提供三个选项以及相关页面的链接。
我需要为此编写脚本吗?或者是我在可用的工具中错过了一些东西?
I'm currently integrating the OpenGraph into a restaurant business. The code/scripts provided seem to work fine in a staging environment, however I want to go one step further: when a person visits the site, and they're logged in to Facebook, I would like to display a specific message for them.
Let's say their name it Steven Smith, I would like to add a section at the top of the site which says "Welcome Steven, what would you like to do?", with three options provided with links to relevant pages.
Is this something that I will need to write a script for? Or is it something that I have missed with the tools available?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这称为“即时个性化”,仅适用于少数精选的 Facebook 合作伙伴。
This is called 'instant personalization' and is only available to a select few Facebook partners.
首先,您需要设置一个应用,让用户对您的应用进行身份验证,然后当用户访问该页面时,您调用 FB.getLoginStatus() 来查看他们是否已连接到您的应用程序。如果是这样,您就知道他们是谁并且可以显示他们的名字。请参阅:https://developers.facebook.com/docs/reference/javascript/
First, you will need to setup an app, have the user authenticate to your app, and then when the user comes to the page and you call
FB.getLoginStatus()
to see if they're already connected to your app. If so, you know who they are and can display their name. See: https://developers.facebook.com/docs/reference/javascript/正如您的规范所说,这正是您想要实现的目标:
https:// Developers.facebook.com/docs/reference/javascript/FB.login/
您需要fb应用程序进行身份验证,身份验证后,获得只读权限(最小的权限,不能发帖或点赞),
然后,
As your spec says, this covers exactly what you want to achieve:
https://developers.facebook.com/docs/reference/javascript/FB.login/
You need fb app to auth, after auth, get the permission for reading only (minimal one which can't post or like),
then,