This page received its last significant update on 4/30/2020

Since then, there have been some significant changes to our strategy, direction, and focus, so statements and recommendations may be outdated and not all examples may work.

If you encounter any inaccuracies, we welcome you to help us improve this page or submit an issue.

# Facebook Ads

The Facebook Ads extractor pulls raw data from the Facebook Marketing API and extracts the following resources from a Facebook Ads account:

  • Ad Creatives
  • Ads
  • Ad Sets
  • Campaigns
  • Ads Insights
    • Breakdown by age and gender
    • Breakdown by country
    • Breakdown by placement and device

For more information you can check the documentation for tap-facebook.

# Facebook Ads Setup

In order to access your Facebook Ads data, you will need the following:

  • Account ID
  • Access Token
  • Start Date

Account ID

Your Facebook Ads Account ID.

To get your Account ID:

  1. Visit the Facebook Ads Manager:
  2. Log in if you haven't already.
  3. Make sure the correct account is selected in the top left corner.

Screenshot of account selector

  1. You will see the Account ID displayed inside the selector. You can also find it in the URL, after ?act= and ahead of any additional parameters starting with &:


  • URL:

    Account ID: 593385444078559

  • URL:

    Account ID: 791728544625001

Access Token

Don't feel like going through the Facebook App setup process?

Connect your Facebook Ads account to acquire this token right away.

Once you authorize Meltano to access your Facebook Ads data, Facebook will generate an access token and provide it to Meltano OAuth Service. The OAuth Service will not store or use the token, and will only display it to you once so that you can copy and paste it into your local Meltano configuration.

# Create App

First, you will need to create a Facebook App through the Developer Portal.

  1. Go to
  2. Log into Facebook if you haven't already. Make sure that your account is an Admin of the Ads Account you will be pulling data from.
  3. Convert your Facebook account to a Developer Account if you haven't done so already. This will not affect your personal Facebook profile, but will give you access to Facebook's developer tools.
  4. Click "My Apps" in the top right, and choose "Create App".
  5. In the modal that appears, enter a "Display Name" of your choosing. Since you will only use this app to generate an Access Token for your own use, the actual display name does not matter too much.
  6. Enter your email address under "Contact Email" if it is not yet populated automatically.
  7. Click "Create App ID".

Screenshot of "Create A New App ID" modal

  1. Under "Add a Product", find "Marketing API", and click "Set Up".

# Generate Access Token

Now that your app has been created and the Marketing API product has been enabled, we can generate an access token.

  1. In the sidebar on the left, expand "Marketing API" if it isn't expanded already.
  2. Under "Marketing API", click "Tools".
  3. Select ads_management, ads_read, and manage_pages under "Select Token Permissions".
  4. Click "Get Token".
  5. Copy the token that appears in the field.

Screenshot of "Get Access Token" section

This is the Access Token you will provide to Meltano.

# Token Expiration

Tokens generated using this method are only valid for 60 days by default. When the token expires, Meltano will no longer be able to automatically update your Facebook Ads data, and you will need to generate a new token and update the extractor configuration.

To find out exactly when this token will expire, you can use the Access Token Debugger:

  1. Go to
  2. Paste the token into the field at the top.
  3. Click "Debug" on the right.
  4. Look for the value under "Expires".

Screenshot of the Access Token Debugger

To prevent any interruption of your data pipeline, we recommend that you generate and configure a new token before the currently configured one expires:

  1. Go to
  2. Log into Facebook if you haven't already.
  3. Click "My Apps" in the top right, and select the app you created earlier.
  4. Follow the steps under "Generate Access Token" above.

Start Date

This property determines how much historical data will be extracted.

Please be aware that the larger the time period and amount of data, the longer the initial extraction can be expected to take.

# Meltano Setup

# Prerequisites

# Configure the Extractor

Open your Meltano instance and click "Pipelines" in the top navigation bar. You should now see the Extractors page, which contains various options for connecting your data sources.

Screenshot of Meltano UI with all extractors not installed and Facebook Ads Extractor highlighted

Let's install the Facebook Ads Extractor by clicking on the Install button inside its card.

On the configuration modal we want to enter the Account ID and Access Token that Facebook Ads extractor will use to connect to the Facebook Marketing API, the Start Date we want the extracted data set to start from and the End Date.

Screenshot of the Facebook Ads Extractor Configuration

# Advanced: Command Line Installation

  1. Navigate to your Meltano project in the terminal
  2. Run the following command:
meltano add extractor tap-facebook

If you are successful, you should see Added and installed extractors 'tap-facebook' in your terminal.

# Configuration

  1. Open your project's .env file in a text editor
  2. Add the following variables to your file:


export TAP_FACEBOOK_ACCOUNT_ID="123456789012345"
export TAP_FACEBOOK_START_DATE="2019-12-01T00:00:00Z"


export TAP_FACEBOOK_END_DATE="2019-12-31T00:00:00Z"

If TAP_FACEBOOK_INSIGHTS_BUFFER_DAYS sets how many days to start extracting Ads Insights before the start_date (default: 0)

Check the README for more details.