Forum Discussion
Facebook Page Likes
- 10 years ago
I believe this is explicitly prevented by Facebook for either privacy and/or corporate IP purposes
Here is an example with Web.Contents to get your Facebook Likes:
let
YourFacebookObjectName = "datachantblog",
YourAccessToken = "Get the token from Facebook Graph Explorer, or APIGEE", Source = Json.Document(Web.Contents("https://graph.facebook.com/v2.7/" & YourFacebookObjectName & "/insights/page_fans?access_token=" & YourAccessToken)), data = Source[data], #"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"values"}, {"values"}), #"Expanded values" = Table.ExpandListColumn(#"Expanded Column1", "values"), #"Expanded values1" = Table.ExpandRecordColumn(#"Expanded values", "values", {"value", "end_time"}, {"value", "end_time"}) in #"Expanded values1"
Thanks. I played around in the Graph API Explorer and found 'fan_count'. The following seems to do the trick.
= Facebook.Graph("https://graph.facebook.com/v2.7/pagename?fields=fan_count") How do I combine this with dates, so that I can show page likes growth over time?
Engagenment also works, but again I don't know how to combine this with a date.
= Facebook.Graph("https://graph.facebook.com/v2.7/pagename?fields=engagement") - procyon8210 years ago
Resolver I
I tried that using unix timestamp, but it just gives me today's total page likes. How do others answer questions regarding page like growth? It can't be that hard...
- DataChant10 years ago
Most Valuable Professional
Did you try using the Web connector and Insights/page_fans directly?
- procyon8210 years ago
Resolver I
As in using https://www.facebook.com/XXX/insights/page_fans_count ? It tells me not a valid URL.
- DataChant10 years ago
Most Valuable Professional
procyon82, I used a wrong metric name. I meant page_fans as I shown above.
- procyon8210 years ago
Resolver I
That's better...how can I get it to spit out monthly values?
"values": [
{
"value": 7215,
"end_time": "2016-08-25T07:00:00+0000"
},
{
"value": 7220,
"end_time": "2016-08-26T07:00:00+0000"
},
{
"value": 7221,
"end_time": "2016-08-27T07:00:00+0000"
} - sarafenwick9 years agoFrequent Visitor
I'm having trouble getting the since function to work in conjunction with the access token... can you provide how you would modify the below to include a since period?
let
YourFacebookObjectName = "datachantblog",
YourAccessToken = "Get the token from Facebook Graph Explorer, or APIGEE", Source = Json.Document(Web.Contents("https://graph.facebook.com/v2.7/" & YourFacebookObjectName & "/insights/page_fans?access_token=" & YourAccessToken)), data = Source[data], #"Converted to Table" = Table.FromList(data, Splitter.SplitByNothing(), null, null, ExtraValues.Error), #"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"values"}, {"values"}), #"Expanded values" = Table.ExpandListColumn(#"Expanded Column1", "values"), #"Expanded values1" = Table.ExpandRecordColumn(#"Expanded values", "values", {"value", "end_time"}, {"value", "end_time"}) in #"Expanded values1" - DataChant9 years ago
Most Valuable Professional
Dear sarafenwick
You can modify the line below and add the "since=2016-12-31" as a URL parameter after the question mark:
Source = Json.Document(Web.Contents("https://graph.facebook.com/v2.7/" & YourFacebookObjectName & "/insights/page_fans?since=2016-12-31&access_token=" & YourAccessToken)),