How can I know, which pages on my website have been liked?

I have run my personal website http://www.rozenek.com . You are just looking at the page 🙂 My website has about 700 posts and subpages (on May 2014). All pages and posts have individual like buttons.

I started to wonder, how can I know which pages have been liked and how many times?

I have already found that I cannot know names of persons who clicked like and they are not my friends. I just wanted to know which pages were clicked with the like button and how many times.

So I decided to ask for support on the facebook forum https://www.facebook.com/help/community/question/?id=10203466634168271&added.

facebook-sucks

Facebook support system is unbelievably useless – after a week my question was seen by… 3 people including me, hahahaha.

Well, because I know a bit about PHP and MySQL databases I decided to do a very simple script which shows me what articles are liked by people.

The script below has a few cons. Firstly, it shows all articles, does not matter they are liked or not. Secondly it works only with WordPress. However, if you know how your website works, you can very easily modify this script.

 

The script code:

<?

#################### MySQL connection ###############################
$dbhost=”localhost”;
$dbuser=”****************”;
$dbpass=”****************”;
$dbname=”***************”;

mysql_connect($dbhost, $dbuser, $dbpass) or die (“Can not connect to the datebase”);
mysql_select_db($dbname) or die (“Can not choose database names: $dbname – ” . mysql_error());

echo ”
<html>
<head>
<title>FB Likes</title>
</head>
<body>
<table style=\”width: 80%; float: center; margin: auto; border-collapse: collapse (separate); border: 1px solid green;\”>”;

 

$result=mysql_query(“SELECT post_name FROM wp_posts WHERE post_type=’post'”);

while ($get = mysql_fetch_array($result))
{
echo ” <tr>
<td style=\”border: 1px solid black; width: 50%\”>
<iframe src=\”//www.facebook.com/plugins/like.php?href=http://www.rozenek.com/” . $get[‘post_name’] . “/&width&layout=standard&action=like&show_faces=true&share=true&height=80&appId=646582575415297\” scrolling=\”no\” frameborder=\”0\” style=\”border:none; overflow:hidden; height:80px;\” allowTransparency=\”true\”></iframe>
</td>
<td style=\”border: 1px solid black; width: 50%\”>Title: ” . $get[‘post_name’] . “</td>
</tr>”;
}

echo “</table></body></html>”;
?>

 

931 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA
Change the CAPTCHA codeSpeak the CAPTCHA code