# Facebook Ads To BigQuery

# Introduction

The module integrates with the Facebook Ads API to download data about advertising campaigns and save them in Google BigQuery.

# An example of operation

  1. You are configuring the Facebook Ads module.
  2. You are using the module to automatically combine costs with Google Analytics data.
  3. You run reports that show the cost attributed to products, even if they come from campaigns linking to categories.
  4. You optimize your campaigns based on the cost and sales effectiveness of your products.

# Schemat danych

After running the module, 5 new tables will appear in the dataset:

image alt text

Expand to see the data schema for the ads, adsets, campaigns tables
field name mode type
account_id NULLABLE STRING
account_name NULLABLE STRING
account_currency NULLABLE STRING
ad_id NULLABLE STRING
ad_name NULLABLE STRING
adset_id NULLABLE STRING
adset_name NULLABLE STRING
buying_type NULLABLE STRING
campaign_id NULLABLE STRING
campaign_name NULLABLE STRING
attribution_setting NULLABLE STRING
canvas_avg_view_percent NULLABLE FLOAT
canvas_avg_view_time NULLABLE FLOAT
clicks NULLABLE INTEGER
impressions NULLABLE INTEGER
date_start NULLABLE DATE
date_stop NULLABLE DATE
inline_post_engagement NULLABLE INTEGER
inline_link_clicks NULLABLE INTEGER
mobile_app_purchase_roas REPEATED RECORD
objective NULLABLE STRING
place_page_name NULLABLE STRING
spend NULLABLE FLOAT
reach NULLABLE FLOAT
unique_clicks NULLABLE INTEGER
unique_inline_link_clicks NULLABLE INTEGER
publisher_platform NULLABLE STRING
device_platform NULLABLE STRING
platform_position NULLABLE STRING
actions REPEATED RECORD
unique_actions REPEATED RECORD
action_values REPEATED RECORD
outbound_clicks REPEATED RECORD
unique_outbound_clicks REPEATED RECORD
website_purchase_roas REPEATED RECORD
conversions REPEATED RECORD
mobile_app_purchase_roas.action_type NULLABLE STRING
mobile_app_purchase_roas.value NULLABLE FLOAT
mobile_app_purchase_roas.click_1d NULLABLE FLOAT
mobile_app_purchase_roas.click_7d NULLABLE FLOAT
mobile_app_purchase_roas.click_28d NULLABLE FLOAT
mobile_app_purchase_roas.view_1d NULLABLE FLOAT
mobile_app_purchase_roas.view_7d NULLABLE FLOAT
mobile_app_purchase_roas.view_28d NULLABLE FLOAT
actions.action_type NULLABLE STRING
actions.value NULLABLE FLOAT
actions.click_1d NULLABLE FLOAT
actions.click_7d NULLABLE FLOAT
actions.click_28d NULLABLE FLOAT
actions.view_1d NULLABLE FLOAT
actions.view_7d NULLABLE FLOAT
actions.view_28d NULLABLE FLOAT
unique_actions.action_type NULLABLE STRING
unique_actions.value NULLABLE FLOAT
unique_actions.click_1d NULLABLE FLOAT
unique_actions.click_7d NULLABLE FLOAT
unique_actions.click_28d NULLABLE FLOAT
unique_actions.view_1d NULLABLE FLOAT
unique_actions.view_7d NULLABLE FLOAT
unique_actions.view_28d NULLABLE FLOAT
action_values.action_type NULLABLE STRING
action_values.value NULLABLE FLOAT
action_values.click_1d NULLABLE FLOAT
action_values.click_7d NULLABLE FLOAT
action_values.click_28d NULLABLE FLOAT
action_values.view_1d NULLABLE FLOAT
action_values.view_7d NULLABLE FLOAT
action_values.view_28d NULLABLE FLOAT
outbound_clicks.action_type NULLABLE STRING
outbound_clicks.value NULLABLE FLOAT
outbound_clicks.click_1d NULLABLE FLOAT
outbound_clicks.click_7d NULLABLE FLOAT
outbound_clicks.click_28d NULLABLE FLOAT
outbound_clicks.view_1d NULLABLE FLOAT
outbound_clicks.view_7d NULLABLE FLOAT
outbound_clicks.view_28d NULLABLE FLOAT
unique_outbound_clicks.action_type NULLABLE STRING
unique_outbound_clicks.value NULLABLE FLOAT
unique_outbound_clicks.click_1d NULLABLE FLOAT
unique_outbound_clicks.click_7d NULLABLE FLOAT
unique_outbound_clicks.click_28d NULLABLE FLOAT
unique_outbound_clicks.view_1d NULLABLE FLOAT
unique_outbound_clicks.view_7d NULLABLE FLOAT
unique_outbound_clicks.view_28d NULLABLE FLOAT
website_purchase_roas.action_type NULLABLE STRING
website_purchase_roas.value NULLABLE FLOAT
website_purchase_roas.click_1d NULLABLE FLOAT
website_purchase_roas.click_7d NULLABLE FLOAT
website_purchase_roas.click_28d NULLABLE FLOAT
website_purchase_roas.view_1d NULLABLE FLOAT
website_purchase_roas.view_7d NULLABLE FLOAT
website_purchase_roas.view_28d NULLABLE FLOAT
conversions.action_type NULLABLE STRING
conversions.value NULLABLE FLOAT
conversions.click_1d NULLABLE FLOAT
conversions.click_7d NULLABLE FLOAT
conversions.click_28d NULLABLE FLOAT
conversions.view_1d NULLABLE FLOAT
conversions.view_7d NULLABLE FLOAT
conversions.view_28d NULLABLE FLOAT
Expand to see the data schema for the products table
field name mode type
account_id NULLABLE STRING
account_name NULLABLE STRING
account_currency NULLABLE STRING
ad_id NULLABLE STRING
ad_name NULLABLE STRING
adset_id NULLABLE STRING
adset_name NULLABLE STRING
buying_type NULLABLE STRING
campaign_id NULLABLE STRING
campaign_name NULLABLE STRING
attribution_setting NULLABLE STRING
product_id NULLABLE STRING
clicks NULLABLE INTEGER
impressions NULLABLE INTEGER
date_start NULLABLE DATE
date_stop NULLABLE DATE
inline_post_engagement NULLABLE INTEGER
inline_link_clicks NULLABLE INTEGER
objective NULLABLE STRING
spend NULLABLE FLOAT
outbound_clicks REPEATED RECORD
outbound_clicks.action_type NULLABLE STRING
outbound_clicks.value NULLABLE FLOAT
outbound_clicks.inline NULLABLE FLOAT
Expand to see the data schema for the video table
field name mode type
account_id NULLABLE STRING
account_name NULLABLE STRING
ad_id NULLABLE STRING
ad_name NULLABLE STRING
adset_id NULLABLE STRING
adset_name NULLABLE STRING
campaign_id NULLABLE STRING
campaign_name NULLABLE STRING
attribution_setting NULLABLE STRING
video_30_sec_watched_actions REPEATED RECORD
video_avg_time_watched_actions REPEATED RECORD
video_p100_watched_actions REPEATED RECORD
video_p25_watched_actions REPEATED RECORD
video_p50_watched_actions REPEATED RECORD
video_p75_watched_actions REPEATED RECORD
video_p95_watched_actions REPEATED RECORD
date_start NULLABLE DATE
date_stop NULLABLE DATE
publisher_platform NULLABLE STRING
device_platform NULLABLE STRING
platform_position NULLABLE STRING
video_30_sec_watched_actions.action_type NULLABLE STRING
video_30_sec_watched_actions.value NULLABLE FLOAT
video_30_sec_watched_actions.click_1d NULLABLE FLOAT
video_30_sec_watched_actions.click_7d NULLABLE FLOAT
video_30_sec_watched_actions.click_28d NULLABLE FLOAT
video_30_sec_watched_actions.view_1d NULLABLE FLOAT
video_30_sec_watched_actions.view_7d NULLABLE FLOAT
video_30_sec_watched_actions.view_28d NULLABLE FLOAT
video_avg_time_watched_actions.action_type NULLABLE STRING
video_avg_time_watched_actions.value NULLABLE FLOAT
video_avg_time_watched_actions.click_1d NULLABLE FLOAT
video_avg_time_watched_actions.click_7d NULLABLE FLOAT
video_avg_time_watched_actions.click_28d NULLABLE FLOAT
video_avg_time_watched_actions.view_1d NULLABLE FLOAT
video_avg_time_watched_actions.view_7d NULLABLE FLOAT
video_avg_time_watched_actions.view_28d NULLABLE FLOAT
video_p100_watched_actions.action_type NULLABLE STRING
video_p100_watched_actions.value NULLABLE FLOAT
video_p100_watched_actions.click_1d NULLABLE FLOAT
video_p100_watched_actions.click_7d NULLABLE FLOAT
video_p100_watched_actions.click_28d NULLABLE FLOAT
video_p100_watched_actions.view_1d NULLABLE FLOAT
video_p100_watched_actions.view_7d NULLABLE FLOAT
video_p100_watched_actions.view_28d NULLABLE FLOAT
video_p25_watched_actions.action_type NULLABLE STRING
video_p25_watched_actions.value NULLABLE FLOAT
video_p25_watched_actions.click_1d NULLABLE FLOAT
video_p25_watched_actions.click_7d NULLABLE FLOAT
video_p25_watched_actions.click_28d NULLABLE FLOAT
video_p25_watched_actions.view_1d NULLABLE FLOAT
video_p25_watched_actions.view_7d NULLABLE FLOAT
video_p25_watched_actions.view_28d NULLABLE FLOAT
video_p50_watched_actions.action_type NULLABLE STRING
video_p50_watched_actions.value NULLABLE FLOAT
video_p50_watched_actions.click_1d NULLABLE FLOAT
video_p50_watched_actions.click_7d NULLABLE FLOAT
video_p50_watched_actions.click_28d NULLABLE FLOAT
video_p50_watched_actions.view_1d NULLABLE FLOAT
video_p50_watched_actions.view_7d NULLABLE FLOAT
video_p50_watched_actions.view_28d NULLABLE FLOAT
video_p75_watched_actions.action_type NULLABLE STRING
video_p75_watched_actions.value NULLABLE FLOAT
video_p75_watched_actions.click_1d NULLABLE FLOAT
video_p75_watched_actions.click_7d NULLABLE FLOAT
video_p75_watched_actions.click_28d NULLABLE FLOAT
video_p75_watched_actions.view_1d NULLABLE FLOAT
video_p75_watched_actions.view_7d NULLABLE FLOAT
video_p75_watched_actions.view_28d NULLABLE FLOAT
video_p95_watched_actions.action_type NULLABLE STRING
video_p95_watched_actions.value NULLABLE FLOAT
video_p95_watched_actions.click_1d NULLABLE FLOAT
video_p95_watched_actions.click_7d NULLABLE FLOAT
video_p95_watched_actions.click_28d NULLABLE FLOAT
video_p95_watched_actions.view_1d NULLABLE FLOAT
video_p95_watched_actions.view_7d NULLABLE FLOAT
video_p95_watched_actions.view_28d NULLABLE FLOAT

Information about conversions/events are in the action field

image alt text

# Configuration

# Before you start

Access to the Facebook Ads advertising account

NOTE to use this module, you must have access to the Facebook Ads advertising account.

# Start creating the module

From the menu on the left, select the Collect tab, then click the Add new Data Collect button.

image alt text

Choose Facebook from the list of available modules

image alt text

In the first step, we only have one field to fill.

Collect name - the name of our collector, e.g. "Facebook Collect"

image alt text

# Authorization with Facebook

The next step is authorization with Facebook. To do this, press the button and grant the required access to the application.

image alt text

After the authorization process is completed, a drop-down list will be displayed from which you need to select an authorized account.

TIP

If you have already completed the authorization process with Facebook and we do not need a greater range of accesses, authorization will not be required.

image alt text

When you select an account, another drop-down list will appear. This time, select the ad account from which you want to collect data for BigQuery. Press Finish to complete the collector creation process.

# Setting the module in the schedule

Your module is now created in WitCloud 📊. The final step is to determine the time range for which you need to retrieve historical data. The schedule for retrieving current data will be created automatically.

Enter the appropriate range and click the Finish button.

Last updated: 2023-07-05T14:12:16.000Z