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.

Select Facebook Insights from the list of available integrations.

Enter the Collect name, e.g., "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.

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.

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

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.

Click Next to continue.

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

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

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 Name | Mode | Type |
|---|---|---|
| date | NULLABLE | DATE |
| id | NULLABLE | STRING |
| name | NULLABLE | STRING |
| category | NULLABLE | STRING |
| page_fans | NULLABLE | INTEGER |
| page_fan_adds | NULLABLE | INTEGER |
| page_fan_removes | NULLABLE | INTEGER |
| page_follows | NULLABLE | INTEGER |
| page_impressions | NULLABLE | INTEGER |
| page_impressions_paid | NULLABLE | INTEGER |
| page_views_total | NULLABLE | INTEGER |
| page_post_engagements | NULLABLE | INTEGER |
| page_video_views | NULLABLE | INTEGER |
| page_video_views_autoplayed | NULLABLE | INTEGER |
| page_video_views_click_to_play | NULLABLE | INTEGER |
| page_video_views_organic | NULLABLE | INTEGER |
| page_video_views_paid | NULLABLE | INTEGER |
| page_actions_post_reactions_like_total | NULLABLE | INTEGER |
| page_actions_post_reactions_love_total | NULLABLE | INTEGER |
| page_actions_post_reactions_wow_total | NULLABLE | INTEGER |
| page_actions_post_reactions_haha_total | NULLABLE | INTEGER |
| page_actions_post_reactions_sorry_total | NULLABLE | INTEGER |
| page_actions_post_reactions_anger_total | NULLABLE | INTEGER |
Data schema for fb_insights_page_total
| Field Name | Mode | Type |
|---|---|---|
| date | NULLABLE | DATE |
| id | NULLABLE | STRING |
| name | NULLABLE | STRING |
| category | NULLABLE | STRING |
| website | NULLABLE | STRING |
| link | NULLABLE | STRING |
| followers_count | NULLABLE | INTEGER |
| fan_count | NULLABLE | INTEGER |
Data schema for fb_insights_posts
| Field Name | Mode | Type |
|---|---|---|
| date | NULLABLE | DATE |
| id | NULLABLE | STRING |
| created_time | NULLABLE | STRING |
| message | NULLABLE | STRING |
| full_picture | NULLABLE | STRING |
| permalink_url | NULLABLE | STRING |
| status_type | NULLABLE | STRING |
| privacy | NULLABLE | RECORD |
| privacy.allow | NULLABLE | STRING |
| privacy.deny | NULLABLE | STRING |
| privacy.description | NULLABLE | STRING |
| privacy.friends | NULLABLE | STRING |
| privacy.value | NULLABLE | STRING |
| attachments | NULLABLE | RECORD |
| attachments.data | REPEATED | RECORD |
| attachments.data.title | NULLABLE | STRING |
| attachments.data.description | NULLABLE | STRING |
| attachments.data.type | NULLABLE | STRING |
| attachments.data.target | NULLABLE | RECORD |
| attachments.data.target.id | NULLABLE | STRING |
| attachments.data.target.url | NULLABLE | STRING |
| attachments.data.url | NULLABLE | STRING |
| attachments.data.media | NULLABLE | RECORD |
| attachments.data.media.image | NULLABLE | RECORD |
| attachments.data.media.image.height | NULLABLE | INTEGER |
| attachments.data.media.image.width | NULLABLE | INTEGER |
| attachments.data.media.image.src | NULLABLE | STRING |
| attachments.data.media.source | NULLABLE | STRING |
| attachments.data.media_type | NULLABLE | STRING |
| post_impressions | NULLABLE | INTEGER |
| post_impressions_unique | NULLABLE | INTEGER |
| post_impressions_paid | NULLABLE | INTEGER |
| post_impressions_paid_unique | NULLABLE | INTEGER |
| post_impressions_fan | NULLABLE | INTEGER |
| post_impressions_fan_unique | NULLABLE | INTEGER |
| post_impressions_organic | NULLABLE | INTEGER |
| post_impressions_organic_unique | NULLABLE | INTEGER |
| post_impressions_viral | NULLABLE | INTEGER |
| post_impressions_viral_unique | NULLABLE | INTEGER |
| post_impressions_nonviral | NULLABLE | INTEGER |
| post_impressions_nonviral_unique | NULLABLE | INTEGER |
| post_clicks | NULLABLE | INTEGER |
| post_reactions_like_total | NULLABLE | INTEGER |
| post_reactions_love_total | NULLABLE | INTEGER |
| post_reactions_wow_total | NULLABLE | INTEGER |
| post_reactions_haha_total | NULLABLE | INTEGER |
| post_reactions_sorry_total | NULLABLE | INTEGER |
| post_reactions_anger_total | NULLABLE | INTEGER |
| post_video_complete_views_30s_autoplayed | NULLABLE | INTEGER |
| post_video_complete_views_30s_clicked_to_play | NULLABLE | INTEGER |
| post_video_complete_views_30s_organic | NULLABLE | INTEGER |
| post_video_complete_views_30s_paid | NULLABLE | INTEGER |
| post_video_complete_views_30s_unique | NULLABLE | INTEGER |
Data schema for fb_insights_video_reels
| Field Name | Mode | Type |
|---|---|---|
| date | NULLABLE | STRING |
| id | NULLABLE | STRING |
| post_id | NULLABLE | STRING |
| description | NULLABLE | STRING |
| content_category | NULLABLE | STRING |
| permalink_url | NULLABLE | STRING |
| created_time | NULLABLE | STRING |
| picture | NULLABLE | STRING |
| post_video_avg_time_watched | NULLABLE | INTEGER |
| post_video_view_time | NULLABLE | INTEGER |
| post_impressions_unique | NULLABLE | INTEGER |
| blue_reels_play_count | NULLABLE | INTEGER |
| fb_reels_total_plays | NULLABLE | INTEGER |
| fb_reels_replay_count | NULLABLE | INTEGER |
| post_video_followers | NULLABLE | INTEGER |
| post_video_likes_by_reaction_type | NULLABLE | RECORD |
| post_video_likes_by_reaction_type.reaction_like | NULLABLE | INTEGER |
| post_video_likes_by_reaction_type.reaction_love | NULLABLE | INTEGER |
| post_video_likes_by_reaction_type.reaction_anger | NULLABLE | INTEGER |
| post_video_likes_by_reaction_type.reaction_wow | NULLABLE | INTEGER |
| post_video_likes_by_reaction_type.reaction_haha | NULLABLE | INTEGER |
| post_video_social_actions | NULLABLE | RECORD |
| post_video_social_actions.comment | NULLABLE | INTEGER |
| post_video_social_actions.share | NULLABLE | INTEGER |
Data schema for fb_insights_stories
| Field Name | Mode | Type |
|---|---|---|
| date | NULLABLE | DATE |
| post_id | NULLABLE | STRING |
| status | NULLABLE | STRING |
| media_id | NULLABLE | STRING |
| media_type | NULLABLE | STRING |
| creation_time | NULLABLE | TIMESTAMP |
| page_story_impressions_by_story_id | NULLABLE | INTEGER |
| pages_fb_story_sticker_interactions | NULLABLE | INTEGER |
| pages_fb_story_replies | NULLABLE | INTEGER |
| pages_fb_story_thread_lightweight_reactions | NULLABLE | INTEGER |
| pages_fb_story_shares | NULLABLE | INTEGER |
| page_story_impressions_by_story_id_unique | NULLABLE | INTEGER |
| story_interaction | NULLABLE | INTEGER |
