Integration of Instagram Insights with BigQuery
Learn how to connect Instagram Insights to Google BigQuery using WitCloud and automatically fetch account reach and engagement, audience demographics, posts and stories of your Instagram business accounts.
Updated
Introduction
This module integrates with the Instagram Graph API, enabling you to collect statistics of your Instagram business accounts - account reach and engagement, audience demographics (age and gender), posts and stories - and store them in Google Cloud BigQuery.
Configuration guide
Follow the steps below to connect Instagram Insights with BigQuery. Once the setup is complete, your Instagram data will be transferred to your BigQuery project automatically.
Only Instagram business accounts that are linked to a Facebook Page you manage appear in the account list. Make sure the Facebook account you authorize has access to that Page.
Module setup
Go to Integrations in the menu and click Add integration.

Select Instagram Insights from the list of available integrations.

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

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

A Facebook window opens. Log in and allow WitCloud to access: the profile, posts and insights of the Instagram accounts connected to your Pages, the list of Pages you manage, and your business portfolios. Then return to WitCloud.
Account selection
Choose the Instagram accounts you want to collect data from in Select accounts.

You can select several accounts at once - WitCloud creates a separate data collect for each one, named after the collect name and the account username, e.g. "Instagram Insights PL - demo_store".

Optionally, click Show advanced settings to set the Data freshness (media) (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 Instagram 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 instagram_insights_account
| Field Name | Mode | Type |
|---|---|---|
| date | NULLABLE | DATE |
| id | NULLABLE | STRING |
| name | NULLABLE | STRING |
| ig_id | NULLABLE | STRING |
| biography | NULLABLE | STRING |
| username | NULLABLE | STRING |
| website | NULLABLE | STRING |
| followers_count | NULLABLE | INTEGER |
| accounts_engaged | NULLABLE | INTEGER |
| comments | NULLABLE | INTEGER |
| follows_and_unfollows | NULLABLE | INTEGER |
| likes | NULLABLE | INTEGER |
| profile_links_taps | NULLABLE | INTEGER |
| reach | NULLABLE | INTEGER |
| replies | NULLABLE | INTEGER |
| saves | NULLABLE | INTEGER |
| shares | NULLABLE | INTEGER |
| total_interactions | NULLABLE | INTEGER |
| views | NULLABLE | INTEGER |
Data schema for instagram_insights_age_gender
| Field Name | Mode | Type |
|---|---|---|
| date | NULLABLE | DATE |
| id | NULLABLE | STRING |
| name | NULLABLE | STRING |
| ig_id | NULLABLE | STRING |
| biography | NULLABLE | STRING |
| username | NULLABLE | STRING |
| website | NULLABLE | STRING |
| followers_count | NULLABLE | INTEGER |
| engaged_audience_demographics | REPEATED | RECORD |
| engaged_audience_demographics.age | NULLABLE | STRING |
| engaged_audience_demographics.gender | NULLABLE | STRING |
| engaged_audience_demographics.value | NULLABLE | INTEGER |
| follower_demographics | REPEATED | RECORD |
| follower_demographics.age | NULLABLE | STRING |
| follower_demographics.gender | NULLABLE | STRING |
| follower_demographics.value | NULLABLE | INTEGER |
Data schema for instagram_insights_media
| Field Name | Mode | Type |
|---|---|---|
| date | NULLABLE | DATE |
| timestamp | NULLABLE | STRING |
| id | NULLABLE | STRING |
| ig_id | NULLABLE | STRING |
| caption | NULLABLE | STRING |
| media_product_type | NULLABLE | STRING |
| media_type | NULLABLE | STRING |
| permalink | NULLABLE | STRING |
| username | NULLABLE | STRING |
| shortcode | NULLABLE | STRING |
| reach | NULLABLE | INTEGER |
| views | NULLABLE | INTEGER |
| saved | NULLABLE | INTEGER |
| likes | NULLABLE | INTEGER |
| comments | NULLABLE | INTEGER |
| shares | NULLABLE | INTEGER |
| total_interactions | NULLABLE | INTEGER |
| ig_reels_video_view_total_time | NULLABLE | INTEGER |
| ig_reels_avg_watch_time | NULLABLE | INTEGER |
Data schema for instagram_insights_account_reach
| Field Name | Mode | Type |
|---|---|---|
| date | NULLABLE | DATE |
| id | NULLABLE | STRING |
| name | NULLABLE | STRING |
| ig_id | NULLABLE | INTEGER |
| biography | NULLABLE | STRING |
| username | NULLABLE | STRING |
| website | NULLABLE | STRING |
| comments_day | NULLABLE | INTEGER |
| comments_post_day | NULLABLE | INTEGER |
| likes_day | NULLABLE | INTEGER |
| likes_ad_day | NULLABLE | INTEGER |
| likes_post_day | NULLABLE | INTEGER |
| saves_day | NULLABLE | INTEGER |
| saves_reel_day | NULLABLE | INTEGER |
| saves_ad_day | NULLABLE | INTEGER |
| shares_day | NULLABLE | INTEGER |
| total_interactions_day | NULLABLE | INTEGER |
| total_interactions_ad_day | NULLABLE | INTEGER |
| total_interactions_post_day | NULLABLE | INTEGER |
| total_interactions_reel_day | NULLABLE | INTEGER |
| views_day | NULLABLE | INTEGER |
| views_default_do_not_use_day | NULLABLE | INTEGER |
| views_post_day | NULLABLE | INTEGER |
| views_reel_day | NULLABLE | INTEGER |
| views_story_day | NULLABLE | INTEGER |
| views_ad_day | NULLABLE | INTEGER |
| views_carousel_container_day | NULLABLE | INTEGER |
| reach_day | NULLABLE | INTEGER |
| reach_post_day | NULLABLE | INTEGER |
| reach_reel_day | NULLABLE | INTEGER |
| reach_story_day | NULLABLE | INTEGER |
| reach_ad_day | NULLABLE | INTEGER |
| reach_carousel_container_day | NULLABLE | INTEGER |
| reach_week | NULLABLE | INTEGER |
| reach_profile_pic_week | NULLABLE | INTEGER |
| reach_igtv_week | NULLABLE | INTEGER |
| reach_post_week | NULLABLE | INTEGER |
| reach_reel_week | NULLABLE | INTEGER |
| reach_story_week | NULLABLE | INTEGER |
| reach_ad_week | NULLABLE | INTEGER |
| reach_carousel_container_week | NULLABLE | INTEGER |
| reach_28_d | NULLABLE | INTEGER |
| reach_profile_pic_28_d | NULLABLE | INTEGER |
| reach_igtv_28_d | NULLABLE | INTEGER |
| reach_post_28_d | NULLABLE | INTEGER |
| reach_carousel_container_28_d | NULLABLE | INTEGER |
| reach_ad_28_d | NULLABLE | INTEGER |
| reach_story_28_d | NULLABLE | INTEGER |
| reach_reel_28_d | NULLABLE | INTEGER |
Data schema for instagram_insights_stories
| Field Name | Mode | Type |
|---|---|---|
| timestamp | NULLABLE | STRING |
| id | NULLABLE | STRING |
| ig_id | NULLABLE | STRING |
| caption | NULLABLE | STRING |
| media_product_type | NULLABLE | STRING |
| media_type | NULLABLE | STRING |
| permalink | NULLABLE | STRING |
| username | NULLABLE | STRING |
| shortcode | NULLABLE | STRING |
| reach | NULLABLE | INTEGER |
| replies | NULLABLE | INTEGER |
| shares | NULLABLE | INTEGER |
| total_interactions | NULLABLE | INTEGER |
| follows | NULLABLE | INTEGER |
| profile_visits | NULLABLE | INTEGER |
| profile_activity | NULLABLE | INTEGER |
| navigation | NULLABLE | INTEGER |
| views | NULLABLE | INTEGER |
| loaded_at | NULLABLE | TIMESTAMP |
