Skip to Content
Author's profile photo Amit Gupta

Facebook Insights Analyzer using HCP

SAP HANA Cloud platform is nothing less than a revolution for developers. I have never before used such a comprehensive development platform without the hassle of infrastructure and installations. It gives flexibility to developers to build and run applications quickly combined with the massive power of SAP HANA.

In today’s world, social media is an important aspect of any business’s marketing and customer base development. Facebook and Twitter are helping businesses to secure a place in the digital world. It often becomes important for enterprises to understand the customer’s reaction to marketing campaigns and the quality of products or services. Social data analysis is an evolving area which involves determining effectiveness of campaigns and customer’s feedback (in terms of sentiments). Enterprises are even more interested in comparing their social media performance against their competitors.

Here, I have tried to build a small application called “Facebook Insights Analyzer” using SAP HANA Cloud Platform. It compares the social media performance of various companies or individuals using SAP HANA text analysis (sentiments). The best part is that data acquisition and analysis is done in real-time, hence no setup is required; just have to enter Facebook Ids to get instant insights.

Facebook Insights Analyzer


User is required to login to Facebook before using the application. After successful login to Facebook, user can select date range for the analysis. If the number of comments on a post is huge it can hamper application performance. User has an option to set the maximum number of comments for each post which would be used for analysis.

Next, user enters Ids of Facebook pages (either individual or business that can be found in URL when you visit a particular page on Facebook).

The data analysis process is divided into the following 3 steps (3 buttons):

Validate: It validates whether the entered Facebook Ids are valid, and shows basic information about those pages.


This section contains a profile picture, Facebook Id, Facebook name, description, page likes and talked about count (a feature from Facebook which provides how many people are talking about that individual or company).

For example, if we are comparing Facebook performance of US presidential elections 2016 candidates, like Mrs. Hillary Clinton, Mr. Jeb Bush and Mr. Donald Trump, the application will look like as below after pressing validate button.


Acquire: After successful validation, the Acquire button is enabled. By clicking on the Acquire button, the application connects to Facebook and obtains information related to Facebook Ids (based on date range and comment limit selected earlier). All the posts of this time period are retrieved and saved into a database along with their likes, shares and number of comments. Comments for each post (based on maximum limit) are also retrieved and saved. During the acquisition process, the application displays a window to show progress.


Total Posts: Total number of posts during date range.

Total Comments: Total comments on all the posts during date range.

Acquired Posts: Number of posts successfully acquired from Facebook and saved in HANA database.

Acquired Comments: Number of comments acquired and saved in HANA database (based on maximum comment limit).

Once data acquisition is completed, progress window appears as below.


Snapshot after a successful acquisition of data.


Analyze: The Analyze button is enabled once data acquisition is completed. By clicking on the Analyze button, data stored in HANA database is analysed and analysis section is shown.


The analyse section is divided into the following subsections:

Sentimental Analysis: This section contains overall sentiments based on all comments and sentiments trend for the selected period.


Top Posts: This section shows top posts based on popularity (highest positive sentiments), the most liked post and the most commented post. It contains thumbnail picture of the posts and links to view the posts.


Key worlds cloud: This section shows a world cloud based on most frequent words in comments (top 15).


See below snapshot of full application after analysis.


Once analysis is completed, clicking the reset button /wp-content/uploads/2015/11/reset_839144.png deletes all collected data and application is ready for new analysis.

See below another analysis of UK football clubs.


Hope you like this blog. Check out below video to see the application in action.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Christoforos Verras
      Christoforos Verras

      Hi Amit !

      Congratulations for your application!

      Is there any guide on how you done it?

      I am very interesting on PAL ( Sentiment Analysis ) and I have also myself built an Twitter

      analytics application but i faced several problems with the Facebook Graph API and there wasn't any guide on how to use the Graph API.

      Any feedback would be appreciated 🙂



      Author's profile photo Former Member
      Former Member

      Hi Amit,

      Wowww...Mind Blowing !!

      Author's profile photo Swapnil Gharat
      Swapnil Gharat

      Excellent Work !!!!!

      This is a great tool for all analysts

      Author's profile photo Luca Manassero
      Luca Manassero

      Hi Amit,

      this is really impressive and it proves an important point we're facing right now with an external team working with us to a web intelligence project.

      Any chance you would share a part of your Facebook Insights Application?

      It would be extremely helpful.

      Thank you in any case for your very interesting post,