How To Extract Facebook Ads & Page Post Insights: Like, Share & Comment To Sheets

Authorize_Facebook_Addon

Last Updated on September 2, 2019 by Ritwik B

Most of you who follow our blog might have implemented the Facebook Reporting Tool: Automate Cost Data Upload To GA. If not, you should definetely try it out.

But Wait.. You just don’t need to go to that article now. You can just follow along some steps here & then get to that article for scheduling & GA upload feature.

This is just an upgraded version which has some extra features along with page post insights. Here’s the list of some of the features.

  • Facebook Ad Inights
  • Facebook Page Post Insights (Like, Share & Comments)
  • Facebook Post Comments (Text)
  • Full Quota Usage
  • Import Facebook Data To GA
  • Scheduling & Automation.
  • & more…

We have tried to implement the library version which is convinient as well as scalable.  Let’s take a look at some of the use cases so that it’ll help you to see if its a right fit.

  • You can track daily spends for your facebook ad account.
  • You can track comment,likes & share counts on your facebook page posts.
  • You can even track comments (text) on every page post.
  • You can upload the ad insights data to GA
  • etc…

So let’s start…

How To Setup Facebook Ad & Page Post Tool (3 Step Process)

Step – 1

Step – 2

  • Create a Facebook App. (You can name it anything)
  • Go To Facebook App > Settings > Basics
  • Include ‘script.google.com’ in App Domains.
  • Add a website & include ‘https://script.google.com/’

Also,  Copy & Paste the

  • App ID as CLIENT_ID
  • App Secret as CLIENT_SECRET
    in the Script
    (You can find it in Settings > Basics)
FacebookApp_Credentials - AppId & App Secret
FacebookAppCreds_AppScript

Step – 3

  • In the Spreadsheet, click on Reports > OAuth Redirect URI & copy the URL.
Facebook_Reporting_Tool_-_Valid_oAuth_redirectURI
  • Go To Facebook App > Click Add Product > Click Facebook Login Setup
Facebook_Login_Setup
  • Go To Facebook Login > Settings
  • Now, paste the copied URL in the Valid oAuth Redirect URIs (you might find it at the bottom) & Save the settings.
FAcebook App - Valid oAuth Redirect URL

Once that is done…. great.!! You have made your own facebook reporting tool.

To get started just open the sheet & click on Reports  > Open Sidebar.

Once you open the sidebar, click on authorize.

Before Authorization, Make Sure…

  1. You have added the oAuth Redirect URL in the facebook app
  2. You have added Client_ID & Client_Secret in the script. 
Authorize_Facebook_Addon

After authorization, simply select the following fields

  • AccountID: Facebook Page / Facebook Ad Account
  • Date Range: You can select manually or pre-defined date ranges.
  • Fields: Fields Compatible with the account type.
  • Level: Select level. (Only for Ad Accounts)
  • Breakdown: Select Breakdown. (Only for Ad Accounts)

& click on “Export“.

Page_Post_Comment_Tracker

Scheduling & Automation

You can follow the same process as given under “Facebook Cost Data Import in Google Analytics: Automation” in this article.

Authorization Scopes

When you’ll run the script for the first time, you’ll be prompted to authotize the app for the following scopes.

  • Sheet edit,read access: It is required to export the facebook data to your google sheets
  • Display third-party apps: It is required for the sidebar UI to be displayed on your sheets

 

For facebook you’ll use

  • ads_read: To fetch ad insights data
  • manage_pages: To fetch page post data

Lastly...

Some important things…

  1. If you select facebook page in the account id dropdown, you can only select page post fields. (& same goes for ad account)
  2. To schedule the data, you’ll have to manually enter the data in the code.gs file. ( as shown in the article)
  3. If there’s no data for a particular date range, only headers will be exported.
  4. TIP: You can even change ‘companyName’ value (In ACCOUNTDATA) to your company name (replace “digishuffle”), so it’ll get reflected on the tool header menu.

If you have any idea, use case, feature in mind, just drop me a message. Also, if you face any issues (or even implement it successfully), let me know.

Ritwik is a product owner at DigiXport. He also loves to write technical & easy to understand blogs for Marketers & Entrepreneurs. A Firm Believer in Teaching -> Learning -> Growing. :)

One comment

  1. Panda Infosoft is providing an best Data Analytics Services in USA at an affordable Price .Our Data Analytics Marvels Can Empower Your Business And People By Helping You Extracting Actionable Insights With Data Analytics Services. Call Now For Data Analytics Services.

Leave a Reply

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