Skip to main content

Facebook marketing

Prerequisites

Setting up the Facebook marketing connector

Basic Setup

  1. Create a new data source

  2. Select Facebook Marketing

  3. Fill in the Name and Short name

  4. Click on “Login with Facebook” and Authenticate your account

  5. In another window, navigate to Facebook Ads manager https://www.facebook.com/adsmanager/manage/

    Your ad account ID number is shown above the search and filter bar in the account drop-down menu. Refer to the screen shot below:

    An image from the static

    Fill in the account id

  6. Enter the start date in the format YYYY-MM-DDT00:00:00Z

  7. Click on Test connection and add the data source

  8. Add the new data source

info

It might take a couple of minutes to provision a new data source. Once the data source is added you will be able to query it using plain SQL

At this point, you will be able to browse the data structure of the newly added data source. Once the data source is successfully added, and you have verified it in the data browser -- you can use 3rd party tools like DBeaver to connect to the newly created data source. Refer to Using DBeaver

Detailed configuration Information

NoItemRequiredExampleNotes
1Account IDYes111111111111111The Facebook Ad account ID to use when pulling data from the Facebook Marketing API. Open your Meta Ads Manager. The Ad account ID number is in the account dropdown menu or in your browser's address bar. See the docs for more information.
2Start DateYes2017-01-25T00:00:00ZThe date from which you'd like to replicate data for all incremental streams, in the format YYYY-MM-DDT00:00:00Z. All data generated after this date will be replicated.
3End DateNo2017-01-26T00:00:00ZThe date until which you'd like to replicate data for all incremental streams, in the format YYYY-MM-DDT00:00:00Z. All data generated between the start date and this end date will be replicated. Not setting this option will result in always syncing the latest data.
4Access TokenYesThe value of the generated access token. From your App’s Dashboard, click on "Marketing API" then "Tools". Select permissions ads_management, ads_read, read_insights, business_management. Then click on "Get token". See the docs for more information.
5Include Deleted Campaigns, Ads, and AdSetsNoSet to active if you want to include data from deleted Campaigns, Ads, and AdSets.
6Fetch Thumbnail Images from Ad CreativeNoSet to active if you want to fetch the thumbnail_url and store the result in thumbnail_data_url for each Ad Creative.
7Custom InsightsNoA list which contains ad statistics entries, each entry must have a name and can contains fields, breakdowns or action_breakdowns. Click on "add" to fill this field.
8Page Size of RequestsNoPage size used when sending requests to Facebook API to specify number of records per page when response has pagination. Most users do not need to set this field unless they specifically need to tune the connector to address specific issues or use cases.
9Insights Lookback WindowNoThe attribution window. Facebook freezes insight data 28 days after it was generated, which means that all data from the past 28 days may have changed since we last emitted it, so you can retrieve refreshed insights from the past by setting this parameter. If you set a custom lookback window value in Facebook account, please provide the same value here.
10Maximum size of Batched RequestsNoMaximum batch size used when sending batch requests to Facebook API. Most users do not need to set this field unless they specifically need to tune the connector to address specific issues or use cases.

Tables in the Facebook marketing connector

NoTable NameColumnsPrimary KeysRead ModeInc. Sync KeysAPI Info
1custom_conversions17idFull Refresh
2ads20idFull Refresh, Incrementalupdated_timeAPI Reference
3images17idFull Refresh, Incrementalupdated_timeAPI Reference
4ad_account55idFull Refresh
5campaigns22idFull Refresh, Incrementalupdated_timeAPI Reference
6ads_insights_action_breakdowns10
7ads_insights_breakdowns24
8activities12API Reference
9ad_creatives33idFull Refresh
10videos29idFull Refresh, Incrementalupdated_timeAPI Reference
11ads_insights111date_start, account_id, ad_idFull Refresh, Incrementaldate_start
12ad_sets19idFull Refresh, Incrementalupdated_time

Table: custom_conversions

NoColumn NameTypeNotes
1creation_timeVARCHAR
2businessVARCHAR
3custom_event_typeVARCHAR
4event_source_typeVARCHAR
5descriptionVARCHAR
6ruleVARCHAR
7data_sourcesVARCHAR
8is_unavailableBOOLEAN
9offline_conversion_data_setVARCHAR
10first_fired_timeVARCHAR
11account_idVARCHAR
12is_archivedBOOLEAN
13retention_daysDOUBLE
14nameVARCHAR
15idVARCHARPrimary Key
16default_conversion_valueDOUBLE
17last_fired_timeVARCHAR

Table: ads

NoColumn NameTypeNotes
1conversion_specsVARCHAR
2updated_timeVARCHARIncremental sync key
3created_timeVARCHAR
4bid_infoVARCHAR
5last_updated_by_app_idVARCHAR
6bid_typeVARCHAR
7recommendationsVARCHAR
8creativeVARCHAR
9effective_statusVARCHAR
10targetingVARCHAR
11account_idVARCHAR
12adlabelsVARCHAR
13bid_amountINTEGER
14tracking_specsVARCHAR
15adset_idVARCHAR
16nameVARCHAR
17idVARCHARPrimary Key
18campaign_idVARCHAR
19statusVARCHAR
20source_ad_idVARCHAR

Table: images

NoColumn NameTypeNotes
1original_widthINTEGER
2created_timeVARCHAR
3updated_timeVARCHARIncremental sync key
4creativesVARCHAR
5urlVARCHAR
6account_idVARCHAR
7filenameVARCHAR
8nameVARCHAR
9url_128VARCHAR
10widthINTEGER
11original_heightINTEGER
12is_associated_creatives_in_adgroupsBOOLEAN
13idVARCHARPrimary Key
14permalink_urlVARCHAR
15hashVARCHAR
16statusVARCHAR
17heightINTEGER

Table: ad_account

NoColumn NameTypeNotes
1is_direct_deals_enabledBOOLEAN
2media_agencyDOUBLE
3spend_capVARCHAR
4account_statusINTEGER
5business_cityVARCHAR
6business_country_codeVARCHAR
7balanceVARCHAR
8user_tos_acceptedVARCHAR
9funding_sourceDOUBLE
10timezone_nameVARCHAR
11timezone_offset_hours_utcDOUBLE
12idVARCHARPrimary Key
13is_tax_id_requiredBOOLEAN
14business_streetVARCHAR
15has_migrated_permissionsBOOLEAN
16business_nameVARCHAR
17created_timeVARCHAR
18funding_source_detailsVARCHAR
19disable_reasonDOUBLE
20is_notifications_enabledBOOLEAN
21tax_idVARCHAR
22is_personalDOUBLE
23min_daily_budgetDOUBLE
24tos_acceptedVARCHAR
25nameVARCHAR
26timezone_idDOUBLE
27business_street2VARCHAR
28is_attribution_spec_system_defaultBOOLEAN
29user_tasksVARCHAR
30fb_entityDOUBLE
31business_zipVARCHAR
32is_in_3ds_authorization_enabled_marketBOOLEAN
33amount_spentVARCHAR
34extended_credit_invoice_groupVARCHAR
35end_advertiserDOUBLE
36tax_id_typeVARCHAR
37currencyVARCHAR
38can_create_brand_lift_studyBOOLEAN
39line_numbersDOUBLE
40ownerDOUBLE
41capabilitiesVARCHAR
42failed_delivery_checksVARCHAR
43rf_specVARCHAR
44businessVARCHAR
45min_campaign_group_spend_capDOUBLE
46tax_id_statusDOUBLE
47account_idVARCHAR
48end_advertiser_nameVARCHAR
49partnerDOUBLE
50has_advertiser_opted_in_odaxBOOLEAN
51offsite_pixels_tos_acceptedBOOLEAN
52is_prepay_accountBOOLEAN
53ageDOUBLE
54io_numberDOUBLE
55business_stateVARCHAR

Table: campaigns

NoColumn NameTypeNotes
1source_campaign_idDOUBLE
2created_timeVARCHAR
3updated_timeVARCHARIncremental sync key
4issues_infoVARCHAR
5special_ad_category_countryVARCHAR
6lifetime_budgetDOUBLE
7stop_timeVARCHAR
8bid_strategyVARCHAR
9daily_budgetDOUBLE
10spend_capDOUBLE
11smart_promotion_typeVARCHAR
12buying_typeVARCHAR
13objectiveVARCHAR
14effective_statusVARCHAR
15special_ad_categoryVARCHAR
16start_timeVARCHAR
17account_idVARCHAR
18adlabelsVARCHAR
19budget_remainingDOUBLE
20nameVARCHAR
21budget_rebalance_flagBOOLEAN
22idVARCHARPrimary Key

Table: ads_insights_action_breakdowns

NoColumn NameTypeNotes
1action_canvas_component_nameVARCHAR
2action_carousel_card_idVARCHAR
3action_video_soundVARCHAR
4action_typeVARCHAR
5action_video_typeVARCHAR
6action_carousel_card_nameVARCHAR
7action_target_idVARCHAR
8action_destinationVARCHAR
9action_deviceVARCHAR
10action_reactionVARCHAR

Table: ads_insights_breakdowns

NoColumn NameTypeNotes
1impression_deviceVARCHAR
2countryVARCHAR
3genderVARCHAR
4hourly_stats_aggregated_by_advertiser_time_zoneVARCHAR
5skan_conversion_idVARCHAR
6body_assetVARCHAR
7link_url_assetVARCHAR
8title_assetVARCHAR
9frequency_valueVARCHAR
10call_to_action_assetVARCHAR
11place_page_idVARCHAR
12image_assetVARCHAR
13video_assetVARCHAR
14hourly_stats_aggregated_by_audience_time_zoneVARCHAR
15product_idVARCHAR
16ad_format_assetVARCHAR
17platform_positionVARCHAR
18device_platformVARCHAR
19dmaVARCHAR
20publisher_platformVARCHAR
21regionVARCHAR
22app_idVARCHAR
23ageVARCHAR
24description_assetVARCHAR

Table: activities

NoColumn NameTypeNotes
1date_time_in_timezoneVARCHAR
2translated_event_typeVARCHAR
3application_nameVARCHAR
4event_typeVARCHAR
5extra_dataVARCHAR
6object_typeVARCHAR
7object_nameVARCHAR
8actor_nameVARCHAR
9actor_idVARCHAR
10application_idVARCHAR
11object_idVARCHAR
12event_timeVARCHAR

Table: ad_creatives

NoColumn NameTypeNotes
1thumbnail_data_urlVARCHAR
2instagram_actor_idVARCHAR
3object_story_idVARCHAR
4instagram_story_idVARCHAR
5url_tagsVARCHAR
6image_hashVARCHAR
7call_to_action_typeVARCHAR
8template_url_specVARCHAR
9bodyVARCHAR
10titleVARCHAR
11image_cropsVARCHAR
12thumbnail_urlVARCHAR
13link_urlVARCHAR
14idVARCHARPrimary Key
15effective_object_story_idVARCHAR
16object_typeVARCHAR
17image_urlVARCHAR
18product_set_idVARCHAR
19effective_instagram_story_idVARCHAR
20instagram_permalink_urlVARCHAR
21object_idVARCHAR
22link_og_idVARCHAR
23object_story_specVARCHAR
24template_urlVARCHAR
25account_idVARCHAR
26adlabelsVARCHAR
27asset_feed_specVARCHAR
28object_urlVARCHAR
29applink_treatmentVARCHAR
30nameVARCHAR
31actor_idVARCHAR
32statusVARCHAR
33video_idVARCHAR

Table: videos

NoColumn NameTypeNotes
1updated_timeVARCHARIncremental sync key
2content_categoryVARCHAR
3iconVARCHAR
4descriptionVARCHAR
5content_tagsVARCHAR
6sourceVARCHAR
7titleVARCHAR
8is_crosspost_videoBOOLEAN
9scheduled_publish_timeVARCHAR
10premiere_living_room_statusBOOLEAN
11backdated_time_granularityVARCHAR
12is_instagram_eligibleBOOLEAN
13is_crossposting_eligibleBOOLEAN
14idVARCHARPrimary Key
15post_viewsINTEGER
16viewsINTEGER
17live_statusVARCHAR
18created_timeVARCHAR
19custom_labelsVARCHAR
20universal_video_idVARCHAR
21embed_htmlVARCHAR
22formatVARCHAR
23lengthDOUBLE
24publishedBOOLEAN
25ad_breaksVARCHAR
26is_episodeBOOLEAN
27backdated_timeVARCHAR
28permalink_urlVARCHAR
29embeddableBOOLEAN

Table: ads_insights

NoColumn NameTypeNotes
1cost_per_estimated_ad_recallersDOUBLE
2optimization_goalVARCHAR
3updated_timeVARCHAR
4reachINTEGER
5cost_per_unique_action_typeVARCHAR
6buying_typeVARCHAR
7objectiveVARCHAR
8video_30_sec_watched_actionsVARCHAR
9cost_per_thruplayVARCHAR
10instant_experience_outbound_clicksVARCHAR
11unique_clicksINTEGER
12unique_outbound_clicksVARCHAR
13estimated_ad_recall_rate_upper_boundDOUBLE
14video_p75_watched_actionsVARCHAR
15cost_per_unique_inline_link_clickDOUBLE
16canvas_avg_view_timeDOUBLE
17inline_link_click_ctrDOUBLE
18ctrDOUBLE
19video_avg_time_watched_actionsVARCHAR
20video_play_retention_20_to_60s_actionsVARCHAR
21ad_click_actionsVARCHAR
22cost_per_ad_clickVARCHAR
23labelsVARCHAR
24unique_link_clicks_ctrDOUBLE
25video_p95_watched_actionsVARCHAR
26ad_idVARCHARPrimary Key
27full_view_reachDOUBLE
28catalog_segment_valueVARCHAR
29cost_per_unique_outbound_clickVARCHAR
30inline_post_engagementINTEGER
31auction_competitivenessDOUBLE
32actionsVARCHAR
33catalog_segment_value_omni_purchase_roasVARCHAR
34video_continuous_2_sec_watched_actionsVARCHAR
35unique_outbound_clicks_ctrVARCHAR
36conversionsVARCHAR
37estimated_ad_recall_rateDOUBLE
38attribution_settingVARCHAR
39video_play_retention_0_to_15s_actionsVARCHAR
40cost_per_action_typeVARCHAR
41outbound_clicks_ctrVARCHAR
42unique_inline_link_click_ctrDOUBLE
43catalog_segment_actionsVARCHAR
44cost_per_15_sec_video_viewVARCHAR
45estimated_ad_recallers_upper_boundDOUBLE
46account_nameVARCHAR
47video_time_watched_actionsVARCHAR
48wish_bidDOUBLE
49unique_inline_link_clicksINTEGER
50video_p100_watched_actionsVARCHAR
51cost_per_conversionVARCHAR
52video_p50_watched_actionsVARCHAR
53outbound_clicksVARCHAR
54converted_product_quantityVARCHAR
55qualifying_question_qualify_answer_rateDOUBLE
56ad_nameVARCHAR
57impressionsINTEGER
58full_view_impressionsDOUBLE
59account_idVARCHARPrimary Key
60website_purchase_roasVARCHAR
61estimated_ad_recall_rate_lower_boundDOUBLE
62instant_experience_clicks_to_openDOUBLE
63adset_nameVARCHAR
64social_spendDOUBLE
65video_play_curve_actionsVARCHAR
66age_targetingVARCHAR
67frequencyDOUBLE
68action_valuesVARCHAR
69cpcDOUBLE
70campaign_idVARCHAR
71cpmDOUBLE
72created_timeVARCHAR
73cppDOUBLE
74conversion_rate_rankingVARCHAR
75cost_per_inline_link_clickDOUBLE
76video_play_retention_graph_actionsVARCHAR
77date_startVARCHARIncremental sync key, Primary Key
78conversion_valuesVARCHAR
79adset_idVARCHAR
80purchase_roasVARCHAR
81estimated_ad_recallersDOUBLE
82cost_per_unique_clickDOUBLE
83account_currencyVARCHAR
84inline_link_clicksINTEGER
85video_15_sec_watched_actionsVARCHAR
86website_ctrVARCHAR
87auction_max_competitor_bidDOUBLE
88converted_product_valueVARCHAR
89auction_bidDOUBLE
90catalog_segment_value_website_purchase_roasVARCHAR
91campaign_nameVARCHAR
92cost_per_inline_post_engagementDOUBLE
93unique_actionsVARCHAR
94spendDOUBLE
95catalog_segment_value_mobile_purchase_roasVARCHAR
96date_stopVARCHAR
97video_play_actionsVARCHAR
98video_p25_watched_actionsVARCHAR
99cost_per_outbound_clickVARCHAR
100canvas_avg_view_percentDOUBLE
101quality_rankingVARCHAR
102unique_ctrDOUBLE
103instant_experience_clicks_to_startDOUBLE
104cost_per_2_sec_continuous_video_viewVARCHAR
105estimated_ad_recallers_lower_boundDOUBLE
106clicksINTEGER
107engagement_rate_rankingVARCHAR
108locationVARCHAR
109gender_targetingVARCHAR
110ad_impression_actionsVARCHAR
111mobile_app_purchase_roasVARCHAR

Table: ad_sets

NoColumn NameTypeNotes
1updated_timeVARCHARIncremental sync key
2created_timeVARCHAR
3bid_infoVARCHAR
4lifetime_budgetDOUBLE
5bid_strategyVARCHAR
6end_timeVARCHAR
7daily_budgetDOUBLE
8effective_statusVARCHAR
9start_timeVARCHAR
10targetingVARCHAR
11account_idVARCHAR
12adlabelsVARCHAR
13bid_amountDOUBLE
14budget_remainingDOUBLE
15promoted_objectVARCHAR
16nameVARCHAR
17bid_constraintsVARCHAR
18idVARCHARPrimary Key
19campaign_idVARCHAR

External Resources

Zipstack Cloud features a powerful SQL querying engine on top of many types of connectors, including those from Trino, some custom connectors and connectors from the open source Airbyte project. Some Zipstack cloud connectors are designed to utilize and expand upon Airbyte's connector protocol, but they do not use Airbyte's EL core. Additionally, some parts of the documentation for these connectors have been adapted from the connector documentation found in Airbyte's open source project.