用户验证 FB 应用程序后,如何获得特定域的所有点赞?

发布于 2024-12-23 16:58:19 字数 527 浏览 6 评论 0原文

我有一个名为 example.com 的网站,其中有几个受欢迎的内部页面。

我创建了一个 FB 应用程序。

当用户验证 FB 应用程序时,我想获取所有用户喜欢的内容,例如:example.com/page1、example.com/page2 等

(单个用户在 example.com/page1 的内部页面上最多可以有 100 多个喜欢)。 com)我本质上想要获取经过身份验证的用户在我的 example.com 网站上创建的所有喜欢的 URL(以及关联的 FB 图形 ID)。

有办法做到这一点吗?

也许通过 facebook.api 调用?或者可能是 FQL 查询?我对 PHP 或 JS 持开放态度。

请帮忙!谢谢。

...仅供参考,我最初的想法是为每个用户获取他们所有的喜欢,解析每个用户以确保它来自 example.com,然后将那些喜欢的 URL 存储到本地数据库中。当用户重新访问该网站时,我将查询我的数据库以查找与该用户相关的喜欢。这似乎不是最有效的,因为它需要存储我网站上所有的点赞。任何帮助将不胜感激。

I have a website called example.com with several internal pages that are liked.

I created a FB app.

when a user authenticates the FB app, I want to fetch ALL user likes such as: example.com/page1, example.com/page2, etc.

(a single user can have up to 100+ likes on the internal pages of example.com) I essentially want to get all the liked URL's (and associated FB graph ID) the authenticated user has made on my example.com website.

is there a way to do this?

perhaps via a facebook.api call? or perhaps a FQL query? I am open to PHP or JS.

please help! thanks.

...fyi, My initial thought is to for each user, fetch ALL their likes, parse through each one to make sure it came from example.com, and then store those like URL's into a local database. when the user re-visits the site, I will query my database for likes associated with that user. this did not seem the most efficient as it would require storing all likes ever made on my website. any help would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

心意如水 2024-12-30 16:58:19

如果您只想存储用户何时喜欢您网站上的某个页面,为什么不使用 Facebook JS SDK 提供的 edge.createedge.remove 事件呢?例子:

FB.Event.subscribe('edge.create', function(targetUrl, elm) {
    // Make a request to server to save 'Like' information
});

FB.Event.subscribe('edge.remove', function(targetUrl, elm) {
    // Make a request to server to remove 'Like' information
});

If you just want to store when a user likes a page on your website why not make use of the edge.create and edge.remove events the Facebook JS SDK provides? Example:

FB.Event.subscribe('edge.create', function(targetUrl, elm) {
    // Make a request to server to save 'Like' information
});

FB.Event.subscribe('edge.remove', function(targetUrl, elm) {
    // Make a request to server to remove 'Like' information
});
秋叶绚丽 2024-12-30 16:58:19

我在 like 插件的属性中看到,您可以使用 ref 属性来确定 like 的来源。当然,您的 href 属性在“like”按钮的所有位置都需要相同。

或者,您可以使用 Facebook Insights 注册您的网站并在那里进行跟踪。请参阅https://www.facebook.com/insights/

I see in the attributes of the like plugin, that the ref attribute might be what you could use to determine where a like came from. Of course your href attribute would need to be the same on all locations of the like button.

Or, you can register your site with facebook insights and track it there. See https://www.facebook.com/insights/

冰雪之触 2024-12-30 16:58:19

用户 API 参考位于:https://developers.facebook.com/docs/reference /api/user/

以下是通过 JS API 获取所有点赞的方法(除非它们超过一页,否则您将获得点赞的子集):

FB.api('/me/likes', function(response) {
   console.log(response);
});

您需要登录,并且需要user_likes 权限。

The User API reference is here: https://developers.facebook.com/docs/reference/api/user/

Here's how you get all the likes via the JS API (unless they're more than one page, they you get a subset of the likes):

FB.api('/me/likes', function(response) {
   console.log(response);
});

You need to be logged in, and you need the user_likes permission.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文