Integration of Facebook Insights with BigQuery

Learn how to connect Facebook Insights to Google BigQuery using WitCloud and automatically fetch reach and engagement statistics of your Facebook Pages, posts, reels and stories.

Updated

Introduction

This module integrates with the Facebook Graph API, enabling you to collect reach and engagement statistics of your Facebook Pages - page metrics, posts, reels and stories - and store them in Google Cloud BigQuery.

Configuration guide

Follow the steps below to connect Facebook Insights with BigQuery. Once the setup is complete, your Page data will be transferred to your BigQuery project automatically.

Make sure the Facebook account you authorize has access to the Facebook Pages you want to connect.

Module setup

Go to Integrations in the menu and click Add integration.

Integrations list with the Add integration button

Select Facebook Insights from the list of available integrations.

Integration catalog filtered to Facebook Insights

Enter the Collect name, e.g., "Facebook Insights PL".

Collect name field filled in with the example name Facebook Insights PL

Authorization

If you have already authorized Facebook Insights, simply pick the existing authorization from the Select Facebook authorization drop-down and skip this step.

Click Authorize.

Authorize button next to the Select Facebook authorization field

A Facebook window opens. Log in and allow WitCloud to read your Pages: the list of Pages you manage, Page insights, the content posted on your Pages and its engagement, and your business portfolios. Then return to WitCloud.

Page selection

Choose the Facebook Pages you want to collect data from in Select accounts.

Select accounts drop-down open with example Facebook Pages

You can select several Pages at once - WitCloud creates a separate data collect for each one, named after the collect name and the Page.

Select accounts field with two example Facebook Pages selected

Optionally, click Show advanced settings to set the Data freshness (posts) (from 4 to 12 hours) and to narrow down the Tables to collect if you don't need every table. All tables are selected by default.

Advanced settings with Data freshness (posts) and Tables to collect

Click Next to continue.

Collect settings filled in with the Next button

Historical data and scheduling

In Historical Data, enter the number of days of historical data to fetch - up to 365.

Historical Data field with the number of days

Click Create to complete the configuration. A data synchronization schedule will be created automatically - see Auto workflows.

Historical Data filled in with the Create button

Done! Your Facebook Pages data will now be synchronized with BigQuery.

Data schema

The module creates the tables below in your BigQuery dataset. Expand a table to view its full data schema.

Data schema for fb_insights_page
Field NameModeType
dateNULLABLEDATE
idNULLABLESTRING
nameNULLABLESTRING
categoryNULLABLESTRING
page_fansNULLABLEINTEGER
page_fan_addsNULLABLEINTEGER
page_fan_removesNULLABLEINTEGER
page_followsNULLABLEINTEGER
page_impressionsNULLABLEINTEGER
page_impressions_paidNULLABLEINTEGER
page_views_totalNULLABLEINTEGER
page_post_engagementsNULLABLEINTEGER
page_video_viewsNULLABLEINTEGER
page_video_views_autoplayedNULLABLEINTEGER
page_video_views_click_to_playNULLABLEINTEGER
page_video_views_organicNULLABLEINTEGER
page_video_views_paidNULLABLEINTEGER
page_actions_post_reactions_like_totalNULLABLEINTEGER
page_actions_post_reactions_love_totalNULLABLEINTEGER
page_actions_post_reactions_wow_totalNULLABLEINTEGER
page_actions_post_reactions_haha_totalNULLABLEINTEGER
page_actions_post_reactions_sorry_totalNULLABLEINTEGER
page_actions_post_reactions_anger_totalNULLABLEINTEGER
Data schema for fb_insights_page_total
Field NameModeType
dateNULLABLEDATE
idNULLABLESTRING
nameNULLABLESTRING
categoryNULLABLESTRING
websiteNULLABLESTRING
linkNULLABLESTRING
followers_countNULLABLEINTEGER
fan_countNULLABLEINTEGER
Data schema for fb_insights_posts
Field NameModeType
dateNULLABLEDATE
idNULLABLESTRING
created_timeNULLABLESTRING
messageNULLABLESTRING
full_pictureNULLABLESTRING
permalink_urlNULLABLESTRING
status_typeNULLABLESTRING
privacyNULLABLERECORD
privacy.allowNULLABLESTRING
privacy.denyNULLABLESTRING
privacy.descriptionNULLABLESTRING
privacy.friendsNULLABLESTRING
privacy.valueNULLABLESTRING
attachmentsNULLABLERECORD
attachments.dataREPEATEDRECORD
attachments.data.titleNULLABLESTRING
attachments.data.descriptionNULLABLESTRING
attachments.data.typeNULLABLESTRING
attachments.data.targetNULLABLERECORD
attachments.data.target.idNULLABLESTRING
attachments.data.target.urlNULLABLESTRING
attachments.data.urlNULLABLESTRING
attachments.data.mediaNULLABLERECORD
attachments.data.media.imageNULLABLERECORD
attachments.data.media.image.heightNULLABLEINTEGER
attachments.data.media.image.widthNULLABLEINTEGER
attachments.data.media.image.srcNULLABLESTRING
attachments.data.media.sourceNULLABLESTRING
attachments.data.media_typeNULLABLESTRING
post_impressionsNULLABLEINTEGER
post_impressions_uniqueNULLABLEINTEGER
post_impressions_paidNULLABLEINTEGER
post_impressions_paid_uniqueNULLABLEINTEGER
post_impressions_fanNULLABLEINTEGER
post_impressions_fan_uniqueNULLABLEINTEGER
post_impressions_organicNULLABLEINTEGER
post_impressions_organic_uniqueNULLABLEINTEGER
post_impressions_viralNULLABLEINTEGER
post_impressions_viral_uniqueNULLABLEINTEGER
post_impressions_nonviralNULLABLEINTEGER
post_impressions_nonviral_uniqueNULLABLEINTEGER
post_clicksNULLABLEINTEGER
post_reactions_like_totalNULLABLEINTEGER
post_reactions_love_totalNULLABLEINTEGER
post_reactions_wow_totalNULLABLEINTEGER
post_reactions_haha_totalNULLABLEINTEGER
post_reactions_sorry_totalNULLABLEINTEGER
post_reactions_anger_totalNULLABLEINTEGER
post_video_complete_views_30s_autoplayedNULLABLEINTEGER
post_video_complete_views_30s_clicked_to_playNULLABLEINTEGER
post_video_complete_views_30s_organicNULLABLEINTEGER
post_video_complete_views_30s_paidNULLABLEINTEGER
post_video_complete_views_30s_uniqueNULLABLEINTEGER
Data schema for fb_insights_video_reels
Field NameModeType
dateNULLABLESTRING
idNULLABLESTRING
post_idNULLABLESTRING
descriptionNULLABLESTRING
content_categoryNULLABLESTRING
permalink_urlNULLABLESTRING
created_timeNULLABLESTRING
pictureNULLABLESTRING
post_video_avg_time_watchedNULLABLEINTEGER
post_video_view_timeNULLABLEINTEGER
post_impressions_uniqueNULLABLEINTEGER
blue_reels_play_countNULLABLEINTEGER
fb_reels_total_playsNULLABLEINTEGER
fb_reels_replay_countNULLABLEINTEGER
post_video_followersNULLABLEINTEGER
post_video_likes_by_reaction_typeNULLABLERECORD
post_video_likes_by_reaction_type.reaction_likeNULLABLEINTEGER
post_video_likes_by_reaction_type.reaction_loveNULLABLEINTEGER
post_video_likes_by_reaction_type.reaction_angerNULLABLEINTEGER
post_video_likes_by_reaction_type.reaction_wowNULLABLEINTEGER
post_video_likes_by_reaction_type.reaction_hahaNULLABLEINTEGER
post_video_social_actionsNULLABLERECORD
post_video_social_actions.commentNULLABLEINTEGER
post_video_social_actions.shareNULLABLEINTEGER
Data schema for fb_insights_stories
Field NameModeType
dateNULLABLEDATE
post_idNULLABLESTRING
statusNULLABLESTRING
media_idNULLABLESTRING
media_typeNULLABLESTRING
creation_timeNULLABLETIMESTAMP
page_story_impressions_by_story_idNULLABLEINTEGER
pages_fb_story_sticker_interactionsNULLABLEINTEGER
pages_fb_story_repliesNULLABLEINTEGER
pages_fb_story_thread_lightweight_reactionsNULLABLEINTEGER
pages_fb_story_sharesNULLABLEINTEGER
page_story_impressions_by_story_id_uniqueNULLABLEINTEGER
story_interactionNULLABLEINTEGER