Summary IconKEY TAKEAWAY

There are three different ways to load Facebook Ads data to BigQuery, each with its own benefits and limitations:

Automated ETL process with Hevo Data

As a no-code ETL platform, Hevo lets you:

  • Transfer data from Facebook Ads to BigQuery with minimal setup
  • Handles the transformation and schema mapping automatically
  • Scales with growing data volume with predictable cost
  • Offers low maintenance for the pipeline

Using custom code

Creating custom code for automatic data transfer is ideal for those who can handle code and transfer logic in-house. Transferring data with custom code:

  • Offers more control over the transformation process
  • Helps add custom business and internal logic to the pipeline
  • Requires high infrastructure maintenance and technical knowledge
  • Scaling can be challenging with a growing campaign and data volume

Manual data download and upload

This is ideal for small teams that do not want to automate data transfer to save money from investing in expensive platforms.

  • Cannot scale as the number of campaigns and data volume increase
  • Does not need any advanced technical skills
  • Can be done quickly by downloading and uploading data
  • Takes a lot of time with constant involvement of human efforts

While Facebook Ads data is vital for campaign decisions, it’s hard to analyze data or trust it at scale in Ads Manager. It is also difficult to combine it with data from other sources.

BigQuery solves that problem. It gives you a single place to store Facebook Ads data alongside CRM, product, and revenue data. Once the data is in BigQuery, reporting becomes faster and cheaper.

But getting Facebook Ads data into BigQuery is not simple. Schema changes, API limits, and refresh logic can quickly turn into maintenance work.

That’s why in this actionable guide, we discuss:

  • How to load data from Facebook Ads to BigQuery
  • The benefits of sending data to BigQuerty from Facebook Ads
  • Limitations of transferring Facebook Ads data to BigQuery manually
  • How Hevo Data enables efficient and reliable data transfer at scale

Let’s get started.

Prerequisites to Integrate Facebook Ads into BigQuery

To transfer data from Facebook Ads to BigQuery, you need to meet the following requires from both platforms:

Facebook Ads:

  • Facebook developer app with the Business app type 
  • A valid access token with relevant permissions
  • App ID (clientID) and clientSecret from the Facebook app dashboard

BigQuery:

  • An active Google Cloud project with BigQuery APIs enabled.
  • A BigQuery dataset to store Facebook Ads data.
  • Appropriate IAM roles for the account or service account doing the load

Learn More: What is ETL? Guide to Extract, Transform, Load Your Data

How to Load Data From Facebook Ads to BigQuery

In this guide, we discuss three methods for loading data from Facebook Ads into BigQuery for analysis.

Before we get into the methods, let’s compare them here:

MethodBest forProsCons
Hevo (No-code pipeline)Teams that want accurate, always-fresh ad dataNo code, auto schema handling, API change management, incremental syncs, built-in retries, scheduling handledLimited deep customization
Custom code (API / Webhooks)Engineering-heavy teams with custom needsFull control, custom transformations, real-time ingestion possibleHigh setup time, constant maintenance, API version breaks, scaling issues
Manual export and uploadOne-time or ad-hoc reportingSimple, no tooling requiredManual effort, data delays, high error risk, no automation, not scalable

Method #1: Automate Facebook Ads Data Transfer to BigQuery Using Hevo

Hevo Data is a no-code data pipeline tool built for moving data into warehouses like BigQuery. It handles Facebook Ads API changes, schema updates, and refreshes automatically, so you don’t need to maintain custom scripts or jobs.

Hevo is ideal for teams that want fast and consistent data transfer without writing custom code or managing technical systems.

Here is how to integrate Facebook Ads to BigQuery with Hevo to transfer data:

Step #1: Configure Facebook Ads as a source

Perform the following steps to configure Facebook Ads as the Source in your Pipeline:

  • From the Navigation Bar, choose PIPELINES.
  • Click + Create Pipeline in the Pipelines List View.
  • Now, select Facebook Ads on the Select Source Type page,
  • On the Select Destination Type page, pick the type of Destination you want to use.
  • On the Configure your Facebook Ads account page, do one of the following:
  • Select a previously configured account and click Continue.

Or,

  • Click Add Facebook Ads Account. Follow the steps below to configure a new account:
configure-facebook-ads
  • Log in to your Facebook account and click Continue as <Company Name> in the pop-up dialog.
facebook-hevo
  • Click Save and authorize Hevo to access your Facebook Ads data.
meta-hevo
  • Click Got it in the confirmation dialog.

On the Configure your Facebook Ads Source page, specify the following:

  • Pipeline Name: A unique name for your Pipeline under 255 characters.
  • Select Ad accounts: The Facebook Ads account to replicate the data from.
  • Report Type: Select one of the following report types to ingest data from your Facebook Ads:
  • Ad Action Report Time: The reported time of an action by a Facebook user. The available options are:
  • Historical Sync Duration: The duration for which you want to ingest the existing data from the Source.
  • Attribution Setting:
    • Custom Attribution Window Setting
      • Click Attribution Window: Days between a person clicking your ad and taking an action.
      • View Attribution Window: Days between a person viewing your ad and taking an action.
    • Use Account Attribution Setting: The attribution setting defined by you in your Facebook Ads account.
    • Use Unified Attribution Setting: The attribution settings defined by you for the individual ad sets.
  • Advanced Setting (configure, if needed)
  • Click Continue.

Proceed to configure the data ingestion and set up the Destination.

Step #2: Configure BigQuery as a Destination

In this step, we need to configure BigQuery as the destination to transfer data from Facebook Ads:

Here are the steps to do it:

  • Pick DESTINATIONS from the Navigation Bar
  • From the Destinations List View, click + Create Standard Destination 
  • Now, select Google BigQuery as the Destination type from the Add Destination page.
  • You will be taken to the Configure your Google BigQuery Destination page.
destination

Now, specify the following details on the page:

  • Destination Name: Give the Destination a unique name under 255 characters.
  •  Account: The type of account for authenticating and connecting to BigQuery.
  • Project ID: Select the project ID of your BigQuery instance.
  • Dataset: There are two options:
    • Allow Hevo to create a dataset for you
    • Manually choose a dataset from the list of datasets available for the project ID
  • GCS Bucket: There are two options:
    • Allow Hevo to create a bucket for you
    • Manually choose a bucket from the list of buckets available for the project ID
  • Advanced Settings (enable the settings only if needed)
  • Click Test Connection.
  • Click Save & Continue.

 Step #3: Activate the Pipeline for Data Transfer

After you have configured the source and the destination, all that’s left to do is to activate the Pipeline.

Follow the steps for the same:

  • Go to Hevo Data and sign in, if not already done.
  • Go to your Pipeline from the navigation
  • Click Activate Pipeline

Now, you will see data from Facebook Ads automatically flow into BigQuery on schedule.

Learn More: 20 Best ETL Tools You Should Know About in 2026

Pros and Cons of Using Hevo to Transfer Data Automatically

Using Hevo to automate data transfer between Facebook Ads and BigQuery offers a variety of benefits, such as:

  • No-code setup: Hevo lets you integrate with 150+ sources natively and REST APIs, including Facebook Ads to BigQuery, without writing scripts or dealing with OAuth flows. This reduces setup time and removes engineering dependency.
  • Built-in refresh logic: Hevo handles incremental loads, historical backfills, and retries for consistent, up-to-date data.
  • Scales with data volume: As ad spend, campaigns, or accounts increase, the pipeline continues to run without manual performance tuning or optimization.
  • Automatic schema handling: When Facebook adds, removes, or changes fields, Hevo automatically adapts the schema. You don’t need to update queries or redeploy pipelines every time the API changes.
  • Low maintenance: Hevo manages error handling, API limits, and token refreshes, reducing ongoing maintenance and operational overhead.

At the same time, Hevo also has a few limitations for those who want more control over the transfer, such as:

  • Limited customization: You are constrained by predefined schemas and platform-provided logic.
  • Less control over transformations: You have less control over transformations and may need workarounds for internal business logic.

Learn More: Azure Data Factory ETL Tutorial: Step-by-Step Guide

Move Facebook Ads Data to BigQuery Automatically

You can skip manual exports, fragile scripts, and API headaches with Hevo’s no-code platform. It allows you to send Facebook Ads data to BigQuery with a fully managed, no-code pipeline built for analytics teams.

With Hevo, you can:

  • Handle API changes, schema updates, and historical backfills automatically
  • Sync Facebook Ads data to BigQuery on a schedule, without code
  • Scale across multiple ad accounts and campaigns without rework
  • Keep reporting tables fresh with incremental, reliable data loads
  • Reduce pipeline failures with built-in monitoring and retries

Join 2,000+ data teams using Hevo to simplify ad data pipelines and reduce maintenance. Rated 4.4/5 on G2.

Get Started with Hevo for Free

Method #2: Transfer Facebook Ads Data to BigQuery Using Custom Code

In this method, you can transfer Facebook Ads data to BigQuery using custom code if you are comfortable creating and working with code.

Here is how you can do this:

Step #1: Get Facebook Ads data:

There are two ways to do this:

Option A: Use Facebook Marketing API

1. Create a Facebook Developer Account

Start by registering as a developer.

2. Create a Facebook App

This app will serve as the interface between your code and Facebook’s API.

  • On the Developer Dashboard, click ‘My Apps’ → ‘Create App’.
  • Select the app type: ‘Business’ is a good choice for advertising use cases.
  • Enter a name for the app and your contact email.
  • Click ‘Create App’ and complete the security check.

3. Add the Marketing API Product to Your App

This enables your app to access ad-related data.

  • Inside your app dashboard, scroll down to ‘Add a Product’ on the left menu.
  • Scroll down to Marketing API and click ‘Set Up’.

4. Generate an Access Token

This token lets you authenticate your API calls.

  • In the ‘Tools’ section of your app dashboard, open the ‘Access Token Tool’.
  • Click ‘Get Token’ → Select ‘Get User Access Token’.
  • Select the necessary permissions you’ll need, such as:
    • ads_read
    • ads_management
    • business_management
  • Approve the permission request when prompted by Facebook.
  • You’ll now see your access token in the tool. Copy it. You’ll need this for every API call.

5. Use the Graph API to Fetch Ad Insights

Use this basic Graph API request to pull ad performance data:

curl -G \-d 'access_token=<ACCESS_TOKEN>' \-d 'fields=campaign_name,spend,impressions,clicks' \"https://graph.facebook.com/v18.0/act_<AD_ACCOUNT_ID>/insights"
Option B: Use Real-time Updates (Webhooks)

If you want real-time updates from Facebook Ads, such as when there’s a new campaign, ad, or change in performance metrics, you can use Facebook Webhooks. 

This method pushes data to your system automatically, rather than having you pull it via API calls.

Here’s how to set it up:

1. Create a Facebook App (if not already done)

If you haven’t already created a Facebook App in the Developer portal, follow the same steps as in Option A.

2. Set Up a Webhook Endpoint on Your Server

  • Build an HTTPS endpoint that can receive POST requests from Facebook.
  • The endpoint must handle:
    • A ‘GET’ request for verification (Facebook sends a challenge code).
    • A ‘POST’ request that contains the actual updates when changes happen.

Here is an example of the verification response:

#Pseudocode exampledef webhook_verify(request):    if request.GET['hub.verify_token'] == 'your_custom_token': return request.GET['hub.challenge'] else: return 403

3. Subscribe to the Webhooks

  • Go to your app dashboard on https://developers.facebook.com/ 
  • In the left sidebar, click ‘Webhooks’ → ‘Add Callback URL’.
  • Enter your server’s HTTPS URL and a verify token
  • Choose the object type you want to track, for example: ad_account.
  • Subscribe to fields such as ads, campaigns, adsets, and insights.

4. Grant Permissions and Subscribe to a Page or Ad Account

  • Use an access token with the required permissions (ads_management, pages_manage_ads, etc.) to subscribe your webhook to actual objects, such as a Page or an Ad Account.

Here’s an example Graph API call to subscribe a webhook to an ad account:

curl -X POST \  "https://graph.facebook.com/v18.0/<APP_ID>/subscriptions" \  -F "object=ad_account" \  -F "callback_url=https://yourserver.com/webhook" \  -F "fields=ads,insights" \  -F "verify_token=your_custom_token" \  -F "access_token=YOUR_APP_ACCESS_TOKEN"

5. Process Incoming Data

Once set up, Facebook will send updates to your webhook endpoint anytime a tracked event occurs. This is useful for:

  • Monitoring performance in near real-time
  • Triggering alerts or workflows
  • Syncing data into a warehouse like BigQuery through an ETL pipeline

Step #2: Load Data to BigQuery

After extracting Facebook Ads data, you can get it into BigQuery for analysis in two major ways:

Option A: Use Google Cloud Storage (GCS)

This is one of the most commonly used methods when working with batch files like CSV or JSON.

1. Save the Facebook Ads Data as a File

  • Once you’ve fetched your ad data using the API (or received it through Webhooks and stored it), format it as either:
    • .csv – good for simple tabular data
    • .json – useful for nested structures like ad sets or campaign details

Ensure the data formatting aligns with BigQuery’s supported data types.

2. Upload the File to a GCS Bucket

You have multiple ways to get your file into Google Cloud Storage:

  • Option 1: GCS Console
    • Go to the Google Cloud Console.
    • Open your bucket and click ‘Upload files’.
  • Option 2: Using ‘gsutil’ Command
gsutil cp ./facebook_data.json gs://your-bucket-name/
  • Option 3: Using REST API

Automate uploads with a POST request:

POST /upload/storage/v1/b/my-bucket/o?uploadType=media&name=data.json

3. Create a Load Job in BigQuery

After the data is loaded into the bucket, follow the steps below:

  • Go to ‘BigQuery’ in the ‘Cloud Console’.
  • Click ‘Create Table’.
  • Set the source as ‘Google Cloud Storage’ and select the file.
  • Choose the correct file format (CSV or JSON).
  • Define your table schema manually or let BigQuery auto-detect it.
  • Click ‘Create Table’ to import the data.
Option B: Direct API Upload

Use the BigQuery API to load data directly into BigQuery, skipping the Google Cloud Storage step.

Here is how to use the BigQuery API to send data directly using HTTP POST requests.

1. Format Your Facebook Ads Data as JSON

Before sending the data, make sure it’s in the proper JSON format that BigQuery accepts for insertion.

Here is an example of the JSON format:

[{"campaign_name": "Summer Sale", "impressions": 12000, "clicks": 950,    "spend": 340.75, "date": "2025-07-15"}, { "campaign_name": "Back to School", "impressions": 18000, "clicks": 1200, "spend": 475.00, "date": "2025-07-16"}]

2. Set Up Authentication

Use one of the following to set up the authentication:

  • A ‘service account key file (for server-to-server apps)
  • Or an ‘OAuth token (for user-based apps)

Ensure the credentials have permissions, such as ‘bigquery.tables.insertData and ‘bigquery.jobs.create’.

3. Send Data Using BigQuery’s tabledata.insertAll Endpoint

Here’s a sample POST request using curl:

curl -X POST \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "rows": [ {"json": { "campaign_name": "Summer Sale", "impressions": 12000, "clicks": 950, "spend": 340.75,         "date": "2025-07-15" } } ]}' \ "https://bigquery.googleapis.com/bigquery/v2/projects/YOUR_PROJECT_ID/datasets/YOUR_DATASET_ID/tables/YOUR_TABLE_ID/insertAll"

From the above, you need to replace:

  • YOUR_ACCESS_TOKEN with a valid OAuth or service token
  • YOUR_PROJECT_ID, YOUR_DATASET_ID, and YOUR_TABLE_ID with actual values

4. Monitor the Response for Errors

The API will return a response showing whether the insert was successful or if any rows failed.

Example success response:

{"kind": "bigquery#tableDataInsertAllResponse"}

Any execution errors will be listed with the problematic row index and error type.

Learn More: Airbyte vs Integrate.io: Which Is the Better Data Integration Tool?

Method #3: Sending Data to BigQuery from Facebook Ads Manually

In this method, you can download data from Facebook Ads and upload it to BigQuery manually without writing any code. However, you need to do this repeatedly whenever you need new data or run new campaigns.

Here are the steps to do it:

Step #1: Get Data from Facebook Ads

Follow the steps below to download data from Facebook Ads for the campaign you want to get data for:

  • Open ‘Facebook Ads Manager’.
  • Click ‘Create’ or ‘View a report’.
  • Click ‘Export Table Data’ → Choose ‘CSV format’.
  • Save the file to your computer.

Step #2: Create Google Cloud Project

Create a Google Cloud Project by following the steps below:

  • Go to the ‘BigQuery’ section in the left-hand menu.
  • Check for the project you created

Step 3: Upload Data to BigQuery

  1. Go to BigQuery and select your project.
  2. Click ‘+Create Dataset’ → Give it a name → Click ‘Create’.
  3. Click on your dataset → Click ‘Create Table’.
  4. In the Source section, select ‘Upload’ and choose the downloaded CSV file.
  5. In the Destination section, select your dataset and name your new table.
  6. In the Schema section, choose Auto-detect or enter manually.
  7. Click ‘Create Table’.

The data you downloaded from Facebook Ads will be displayed on BigQuery.

Benefits of Sending Data From Facebook Ads to Google BigQuery

Sending Facebook Ads data to a data warehouse like BigQuery offers you diverse benefits, as explained below:

1. Identify Patterns with SQL Queries

Sending data to BigQuery from Facebook Ads lets you use advanced SQL queries to gain deeper insights into your ad performance. This helps you analyze data from multiple angles, spot patterns, and understand metric correlations.

2. Conduct Multi-channel Ad Analysis

Once you send your data to BiGQuery, you can integrate your Facebook Ads data with metrics from other sources, such as:

  • Google Ads
  • Google Analytics 4
  • CRM or email marketing apps.

Doing this lets you analyze your overall marketing performance and understand how different channels work together.

3. Conduct In-depth Ad Performance Analysis

Using the data transferred from Facebook Ads, you can conduct a time-series analysis. This is a great way to identify changes in ad performance over time and to understand how factors like seasonality affect it.

4. Leverage ML Algorithms

You can also build and train ML models to forecast future performance using the Facebook Ads data in BigQuery. This also lets you identify which factors drive ad success, and optimize your campaigns accordingly.

5. Visualization of Your Campaign Data

​​You can build powerful interactive dashboards using the Facebook Ads data. All you need to do is connect BigQuery to visualization tools, like Power BI, Looker Studio, or another data visualization tool.

This enables you to create custom dashboards that showcase your key metrics, highlight trends, and provide actionable insights.

Using these insights, you can make informed, better decisions faster.

Why Integrate Facebook Ads Into BigQuery: 3 Use Cases

Integrating Facebook Ads into BigQuery is important for businesses in diverse ways.

Here are the top 3 use cases of integrating Facebook Ads with BigQuery:”

1. Run Efficient Marketing Campaigns

Analyzing Facebook Ads audience data in BigQuery can help you enhance the performance of your marketing campaigns.

Transferring the data to BigQuery lets you:

  • Analyze the data in real-time to generate accurate insights
  • Use the insights to understand how the audience responds to campaigns
  • Create informed, data-driven decisions to improve campaign performance

This allows you to ensure every penny spent on the ad goes to help your business meet its campaign goals.

2. Improve Personalized Audience Targeting

You can analyze the Facebook Ads conversion data in BigQuery to segment the audience based on their:

  • Detailed demographic
  • Interests and preferences
  • Behavior patterns

BigQuery’s powerful query capabilities can be used for this, improving personalized targeting and driving better conversions and ad performance.

3. Conduct Competitive Analysis

BigQuery lets you compare your Facebook attribution data to understand competitors’ ad performance.

You can do this by comparing your ad performance with competitors’ using publicly available data sources. This allows you to determine whether you meet the industry performance benchmarks.

Based on the performance insights, you can also optimize the ads to improve performance and outperform industry benchmarks.

Automate Facebook Ads Data Transfer to BigQuery Using Hevo

Moving Facebook Ads data into BigQuery is not about storage. It lets you use data more effectively and intelligently by combining it with CRM, revenue, and product data to run consistent queries and build scalable reports.

However, manual transfer methods don’t scale, and custom code methods break when APIs change or schemas shift. That’s where automated ETL tools, like Hevo, fit in. They handle extraction, loading, and reliability, so your team can focus on analysis rather than pipelines. 

Hevo is one of the strongest no-code ETL platforms for syncing Facebook Ads to BigQuery, with features such as:

  • No-code Facebook Ads connector to connect ad accounts without dealing with OAuth flows, API endpoints, or scheduled scripts.
  • Automatic schema change handling to prevent broken pipelines and failed queries when anything changes in Facebook Ads.
  • Incremental and historical data syncs to pull past performance data and keep daily metrics up to date without duplication.
  • Built-in error handling and retries to reduce data gaps and issues when API limits, token issues, and temporary failures occur.
  • Direct, native loading into BigQuery to make data immediately available for SQL queries, dashboards, and downstream models.

If you want a low-maintenance way to keep Facebook Ads data flowing into BigQuery, try Hevo for free now.

Frequently Asked Questions

How Can You Get Real-time Streams of Your Facebook Ad Statistics?

You can build a near-real-time data pipeline by extracting Facebook Ads data and loading it into a data warehouse using webhooks.

By subscribing to real-time API updates, you can keep your repository continuously refreshed with the latest ad performance data. As Facebook Ads runs on a real-time bidding system, timely data is critical for accurate reporting. Facebook Ads also provides a powerful API that shares granular advertising and account-level data. This makes advanced analysis possible.

But it comes with complexity. The API involves multiple resources and strict protocols, which make building and maintaining real-time pipelines harder than they seem.

How do I get Facebook data into BigQuery?

To get Facebook data into BigQuery you can use one of the following methods:
1. Use ETL Tools
2. Google Cloud Data Transfer Service
3. Run Custom Scripts
4. Manual CSV Upload

How do I integrate Google Ads with BigQuery?

Google Ads has a built-in connector in BigQuery. To use it, go to your BigQuery console, find the data transfer service, and set up a new transfer from Google Ads.

How to extract data from Facebook Ads?

To extract data from Facebook ads, you can use the Facebook Ads API or third-party ETL tools like Hevo Data.

How to prepare Facebook Ads data for BigQuery?

Before loading Facebook Ads data into BigQuery, ensure it’s in CSV or JSON format. BigQuery accepts specific data types only: STRING, INTEGER, FLOAT, TIMESTAMP, and RECORD. If your data is in XML or another format, convert it first. Proper formatting ensures your data integrates smoothly with BigQuery.

Arannyk Monon
Freelance Technical Content Writer, Hevo Data

Arannyk is specialized in writing for the data industry, offering valuable insights and informative content on the complexities of data integration and analysis. He loves to update himself about the latest trends and help businesses through the knowledge.