How to Analyze Sentiment in Facebook Data

How to Analyze Sentiment in Facebook Data

Sentiment analysis is the machine learning process of analyzing text (social media, news articles, emails, etc.) to evaluate for polarity of opinion (positive to negative sentiment) and emotion, theme, tone, etc.

Sentiment analysis performed on Facebook posts can be extremely helpful for companies that want to mine the opinions of users toward their brand, products, and services. Opinions expressed on social media are often the most powerful forms of feedback for businesses because they are given unsolicited. 

Give this free online sentiment analyzer a quick whirl to see how you can gain powerful insights, simply by pasting samples of your Facebook messages.  

To upload data in batches, sign up to MonkeyLearn where you can try sentiment analysis (and other text analysis tools) for free.

Before we show you how to perform sentiment analysis on Facebook data, let’s quickly go over a few benefits:

  • Objective Analysis and Accurate Insights

Humans make mistakes and tire easily. Once a sentiment analyzer is properly trained for your company or your field, you don’t have to worry about errors or oversights.

  • Data Analysis at Scale

Text analysis tools are completely scalable – you can aggressively ramp up your analysis when a sudden need arises, with little or no change in costs, then scale back immediately.

  • Real-time Analysis

Sentiment analysis is completely automated, so you can monitor your social media conversations, 24/7. If something comes up about your company on Facebook, you’ll know right away, so you can get ahead of any potential problems.

How to Do Sentiment Analysis on Facebook Data

If you haven’t already, try out MonkeyLearn’s sentiment analyzer. Or follow along in the tutorial, where you can learn to train your own model for more accurate results and upload files.

MonkeyLearn’s suite of advanced text analysis tools make text mining easy. In just a few steps, you’ll gain serious insights into your Facebook (or any other) data.

You'll need to gather and prepare your data before using MonkeyLearn. Follow the first two steps, then we’ll show you how to analyze it and create your own customer model.

  1. Gather Your Data
  2. Prepare Your Data
  3. Analyze Your Data
  4. Create a Custom Sentiment Analysis Model

1. Data Gathering: Collecting Facebook Data

To collect data from Facebook pages (or other social media sites) you can use web scraping tools, public data sets, and APIs.


Zapier allows you to extract data from one app and connect it to another, using a “zap.” You can extract Facebook posts that mention your company, then instruct Zapier to send them to MonkeyLearn for analysis, all in one step. 

See MonkeyLearn’s sentiment analysis guide to Zapier or Zapier’s Facebook integrations page for more info.


Dexi web crawler allows you to export data from Facebook to a CSV file, and offers direct integration with MonkeyLearn.


Just enter the URL, hit ‘Start,’ and ScrapeStorm will download the text to the file of your choice.

Content Grabber

With the Content Grabber web scraping tool you can pull text from any website and save it as a CSV file to upload to a sentiment analyzer.


Pattern is a GitHub web mining module for Python that includes tools for scraping or direct natural language processing. It has datasets for Facebook, Twitter, YouTube, and more.


The Graph API offers a fairly simple setup for Facebook data extraction.

2. Data Preparing and Cleaning

Facebook posts (or any other unstructured) data can be full of “noise,” like special characters, irrelevant words, incorrect grammar, web links, etc. The sentiment analyzer will ultimately read all of this information as usable words. It’s important you remove them, so as not to influence your tags. 

All of this is especially important when training your own sentiment analysis model because it will be based on language that’s specific to your needs. If the same special characters or irrelevant words appear repeatedly, this will negatively affect your training. You can read more in MonkeyLearn help.

3. Analyze Your Data

Try out MonkeyLearn's pre-trained sentiment analysis model to paste or enter your own text, then click ‘Classify Text’ to see immediate results. The Positive, Negative, or Neutral tag is scored with a confidence level.

Test with your own text



The pre-trained model will generally work great. But if your business or field uses a specific vocabulary, it might be best to train your own. 

4. Create a Custom Sentiment Analysis Model

Sign up to MonkeyLearn for free and follow along to train your own Facebook sentiment analysis tool for super accurate insights.

1. Choose Your Model

Once you’ve signed up, from MonkeyLearn’s dashboard, click ‘Create Model’ in the upper right, then choose ‘Create Classifier.’

2. Choose Sentiment Analysis

3. Import Your Facebook Data

Use your cleaned Facebook data to train a new sentiment analysis model. 

Upload a CSV or Excel file. If your file has more than one column, choose the column you would like to use. You can also import from one of the other available sources.

4. Train Your Facebook Sentiment Analysis Model

Tag each piece of text as Positive, Negative, or Neutral, and click ‘Confirm.’ You can skip sections of text that are completely irrelevant. 

Once you’ve tagged a few, the model will begin making its own predictions. Correct them, if the model has tagged incorrectly.

5. Test Your Model

Once you’ve trained your model, enter new text to test it. This will show a confidence score. The more you train your model, the more accurate it will become.

MonkeyLearn has a number of sentiment analysis statistics to show how well your model is working: Precision and Recall are statistics on tags, and Accuracy and F1 Score for the overall model. The keyword cloud visualizes words that appear most frequently.

The example below requires more tags for Negative.

Facebook Sentiment Analysis: Use Cases and Applications

Facebok offers a wealth of user-generated content you can use to keep in touch with your customers and improve your business.

Monitor Your Brand Reputation Over Time

Merely watching Facebook for brand mentions doesn’t tell the whole story. Targeted sentiment analysis can analyze thousands of those mentions in just a few minutes to understand public perception on a day-to-day basis. With an analyzer trained precisely to your brand, your results will be consistently accurate, and you can follow them over time.

Prevent a PR Crisis

Monitoring Facebook in real time will help you detect problems right away. News can travel around the world in a matter of hours on Facebook. 

When a former Lululemon employee made an offensive T-shirt, essentially blaming Chinese eating habits for COVID-19, social media went after the brand. Even though the offensive material came from someone no longer attached to the company, Lululemon was able to pick up on it, and officially distance themselves.

Sentiment analysis of Facebook can notify you of negative issues right away, so you can get ahead of them before they escalate into bigger problems.

Improve Customer Service

When negative comments arise on social media, you’ll know what to prioritize first. Reach out to customers before they reach out to you.

Conversely, imagine a social media influencer has praised your company or product. You’d want to take advantage of this information right away to join the conversation, ride the wave of positivity, and advance your brand image. 

Discover Insights From Customer Feedback

You can follow marketing campaigns right after launch or compare them across to time to track your efforts. Find out what customers are saying about individual products and new product releases. Find out what features customers love the most and where you might need to improve.

Word cloud visualization gives an interesting view of the most used and most powerful words in your analysis. You can analyze individual positive and negative words to better understand the voice of your customer.

Research the Competition

Competitive research can be particularly easy with sentiment analysis. Compare your brand’s mentions against your competitor’s. Find out what topics and features are most important to each of them, where your company may be lacking, and what you can do to improve.

Final Words

Sentiment analysis of Facebook data can be extremely helpful for any business and super easy to do. Find out exactly how the public feels about your company at any given moment and throughout time.

There are a number of tools and integrations you can use to perform sentiment analysis on Facebook posts. You definitely don’t want to miss out on all that data.

Sign up to MonkeyLearn for free and try out sentiment analysis right now.

Rachel Wolff

June 1st, 2020

Posts you might like...

MonkeyLearn Logo

Text Analysis with Machine Learning

Turn tweets, emails, documents, webpages and more into actionable data. Automate business processes and save hours of manual data processing.

Try MonkeyLearn
Clearbit LogoSegment LogoPubnub LogoProtagonist Logo