如何获取(更好的)Facebook 页面粉丝的人口统计数据?
我正在尝试获取 Facebook 页面粉丝的人口统计数据 - 主要是国家和城市,但年龄和性别是次要的。
FB.api({
method: 'fql.query',
query: "SELECT metric, value FROM insights WHERE object_id='288162265211' AND metric='page_fans_city' AND end_time=end_time_date('2011-04-16') AND period=period('lifetime')"
}, callback);
然而,这样做的问题是,该表仅返回最多 19 条记录,包括国家和城市统计数据。我正在测试的页面的响应是这样的:
[
{
"metric": "page_fans_city",
"value": {
"dallas": "12345",
"atlanta": "12340",
(...)
"miami": "12300"
}
}
]
所以我想知道是否有任何替代方案 - 获取页面当前粉丝的人口统计数据(不需要快照)。
我尝试过的事情:
在查询上使用 LIMIT 和 OFFSET 没有任何作用(除了有时给我一个空列表)。
过去讨论过的一种替代方法是使用“/ Graph API 中的“members”方法(更多信息)来获取列表所有用户,然后解析该列表。这根本行不通 - 存在一种方法,它可能在过去有效,但它不再有效(禁用?)。
请求:
https://graph.facebook.com/platform/members?access_token=...
响应:
{"error":
{
"type":"OAuthException",
"message":"(#604) Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http:\/\/developers.facebook.com\/docs\/reference\/fql "
}}
其他解决方案是对 page_fan 表并按page_id。这也行不通;它可能在过去有效,但现在它说 page_id 列不可索引,因此无法使用(与上面相同的错误,这使我相信 /members 使用已禁用的相同内部 API)。 Page_fan 查询仅用于检查单个用户是否是某个页面的粉丝。
还有 like 表,但这仅对 Facebook 有用项目(如帖子、照片、链接等),而不是 Facebook 页面。
访问有关该页面的见解网站,您可以在一些漂亮的图表和表格中查看数据,并下载包含历史人口统计数据的 Excel/CSV 电子表格......但是,它也将数据限制为 19 个条目(有时 20 个,其中有一些漏洞,因为城市在排名中名列前茅)。
关于如何获取该数据的任何其他提示?我要么想要具有更多结果的见解查询,要么至少有一种获取所有页面粉丝的方法,这样我以后就可以自己进行位置查询(即使我想从中获取它的页面有近 500 万粉丝。)咕噜咕噜)。
I'm trying to get demographics for fans of a page on Facebook - mostly country and city, but age and gender as secondary.
The primary way to do it is using FQL and doing a query in the insights table. Like so:
FB.api({
method: 'fql.query',
query: "SELECT metric, value FROM insights WHERE object_id='288162265211' AND metric='page_fans_city' AND end_time=end_time_date('2011-04-16') AND period=period('lifetime')"
}, callback);
The problem with this, however, is that the table returns a maximum of 19 records only, both for the country and the city stats. The response for a page I'm testing is as such:
[
{
"metric": "page_fans_city",
"value": {
"dallas": "12345",
"atlanta": "12340",
(...)
"miami": "12300"
}
}
]
So I'd like to know if there's any alternative to that -- to get demographics of the current fans of a page (no snapshot necessary).
Things I've tried:
Using LIMIT and OFFSET on the query do nothing (other than, sometimes, give me an empty list).
One alternative that has been discussed in the past is to use the "/members" method from the Graph API (more here) to get a list of all users, and then parse through that list. That simply doesn't work - a method exists, and it may have worked in the past, but it's not valid anymore (disabled?).
Request:
https://graph.facebook.com/platform/members?access_token=...
Response:
{"error":
{
"type":"OAuthException",
"message":"(#604) Your statement is not indexable. The WHERE clause must contain an indexable column. Such columns are marked with * in the tables linked from http:\/\/developers.facebook.com\/docs\/reference\/fql "
}}
Other solution was to do a query to the page_fan table and filtering by page_id. This doesn't work, either; it may have worked in the past, but now it says that the page_id column is not indexable therefore it cannot be used (same error as above, which leads me to believe /members uses the same internal API that has been disabled). Page_fan query is only useful to check if individual users are fans of a page.
There's also the like table, but that's only useful for Facebook items (like posts, photos, links, etc), and not Facebook Pages.
Going to the insights website about the Page, you can see the data in some nice graphs and tables, and download an Excel/CSV spreadsheet with the historic demographics data... however, it also limits the data to 19 entries (sometimes 20 with a few holes in there as cities trade top positions though).
Any other hint on how to get that data? I'd either like the insights query with more results, or at least a way to get all the page fans so I could do the location query myself later (even if the page I want to get it from has almost 5 million fans... gulp).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
该指标的数据管道目前仅限于 20 个项目。这是一个受欢迎的功能请求,Facebook 希望尽快改进。
The data pipeline for this metric is currently limited to 20 items. This is a popular feature request and something Facebook hopes to improve soon.