Posts using facebook Graph API
Post
Cancel

using facebook Graph API

get page profile information with plain JS and FB graph

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//testarea

	<title>
			PipisCrew - Testarea
	</title>

		$(function()
			{

				$.get( "http://graph.facebook.com/cocacola", function( data ) {
					  var x;

					  x = "Category : " + data.category;

					  var likes = parseInt(data.likes);
					  x += "  
Likes : " + likes;

					  var tat = parseInt(data.talking_about_count);
					  x += "  
TAT : " + tat;

					  var res =  (tat/likes) * 100;					  
					  x += "  
Engagement Rate : " + parseFloat(res).toFixed(2);

					  $("#result").html(x);
				}).fail(function() {
					  alert('please check the Facebook handle'); 
				});

			});

		<div id="result">
		</div>

FYI the data object returned :

origin - http://www.pipiscrew.com/?p=3026 js-using-facebook-graph-api

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags