Query Facebook Marketing data

With its PostgreSQL-compatible interface, Splitgraph is the easiest way to get data from Facebook Marketing queryable with any of your BI tools.

use tools

What is Splitgraph?

Splitgraph is a data API to power your analytics, data visualizations and other read-intensive applications.

Get started
 

Connecting Facebook Marketing to your query tool with Splitgraph

First, connect Splitgraph to Facebook Marketing.
This will create a Splitgraph repository with data from Facebook Marketing.
You can now query it with any SQL client or BI tool that supports PostgreSQL.
Now, connect your query tool to Splitgraph.
Data from Facebook Marketing will now be available to query directly from your SQL client.

Tables available in the Facebook Marketing data source

Here are all the tables you will be able to access when you use Splitgraph to query Facebook Marketing data. We have also listed some useful queries that you can run.

ad_account

See all sample queries
 
  •  
    Ad Account Average Account Status by Ad Account Tax Id Type
  •  
    Ad Account Average Account Status, Average Tax Id Status by Ad Account Funding Source Details Display String
  •  
    Ad Account Average Account Status, Average Timezone Offset Hours Utc by Ad Account Balance
repositories:
- namespace: CHANGEME
  repository: airbyte-facebook-marketing
  # Catalog-specific metadata for the repository. Optional.
  metadata:
    readme:
      text: Readme
    description: Description of the repository
    topics:
    - sample_topic
  # Data source settings for the repository. Optional.
  external:
    # Name of the credential that the plugin uses. This can also be a credential_id if the
    # credential is already registered on Splitgraph.
    credential: airbyte-facebook-marketing
    plugin: airbyte-facebook-marketing
    # Plugin-specific parameters matching the plugin's parameters schema
    params:
      account_id: '111111111111111'  # REQUIRED. Account ID. The Facebook Ad account ID to use when pulling data from the Facebook Marketing API.
      start_date: '2017-01-25T00:00:00Z' # REQUIRED. Start Date. The 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.
      normalization_mode: basic # Post-ingestion normalization. Whether to normalize raw Airbyte tables. `none` is no normalization, `basic` is Airbyte's basic normalization, `custom` is a custom dbt transformation on the data.. One of none, basic, custom
      normalization_git_branch: master # dbt model Git branch. Branch or commit hash to use for the normalization dbt project.
      end_date: '2017-01-26T00:00:00Z' # End Date. The 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 start_date and this date will be replicated. Not setting this option will result in always syncing the latest data.
      include_deleted: false # Include Deleted. Include data from deleted Campaigns, Ads, and AdSets
      fetch_thumbnail_images: false # Fetch Thumbnail Images. In each Ad Creative, fetch the thumbnail_url and store the result in thumbnail_data_url
      custom_insights: # Custom Insights. A list which contains insights entries, each entry must have a name and can contains fields, breakdowns or action_breakdowns)
      - name: ''  # REQUIRED. Name. The name value of insight
        fields: [] # Fields. A list of chosen fields for fields parameter
        breakdowns: [] # Breakdowns. A list of chosen breakdowns for breakdowns
        action_breakdowns: [] # Action Breakdowns. A list of chosen action_breakdowns for action_breakdowns
        time_increment: 1 # Time Increment. Time window in days by which to aggregate statistics. The sync will be chunked into N day intervals, where N is the number of days you specified. For example, if you set this value to 7, then all statistics will be reported as 7-day aggregates by starting from the start_date. If the start and end dates are October 1st and October 30th, then the connector will output 5 records: 01 - 06, 07 - 13, 14 - 20, 21 - 27, and 28 - 30 (3 days only).
        start_date: '2017-01-25T00:00:00Z' # Start Date. The date from which you'd like to replicate data for this stream, in the format YYYY-MM-DDT00:00:00Z.
        end_date: '2017-01-26T00:00:00Z' # End Date. The date until which you'd like to replicate data for this stream, in the format YYYY-MM-DDT00:00:00Z. All data generated between the start date and this date will be replicated. Not setting this option will result in always syncing the latest data.
      page_size: 100 # Page Size of Requests. Page 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.
    tables:
      sample_table:
        # Plugin-specific table parameters matching the plugin's schema
        options:
          airbyte_cursor_field: []  # Cursor field(s). Fields in this stream to be used as a cursor for incremental replication (overrides Airbyte configuration's cursor_field)
          airbyte_primary_key_field: [] # Primary key field(s). Fields in this stream to be used as a primary key for deduplication (overrides Airbyte configuration's primary_key)
        # Schema of the table, a list of objects with `name` and `type`. If set to `[]`, will infer. 
        schema: []
    # Whether live querying is enabled for the plugin (creates a "live" tag in the
    # repository proxying to the data source). The plugin must support live querying.
    is_live: false
    # Ingestion schedule settings. Disable this if you're using GitHub Actions or other methods
    # to trigger ingestion.
    schedule:
credentials:
  airbyte-facebook-marketing:  # This is the name of this credential that "external" sections can reference.
    plugin: airbyte-facebook-marketing
    # Credential-specific data matching the plugin's credential schema
    data:
      access_token: ''  # REQUIRED. Access Token. The value of the access token generated. See the <a href="https://docs.airbyte.io/integrations/sources/facebook-marketing">docs</a> for more information
      normalization_git_url: '' # dbt model Git URL. For `custom` normalization, a URL to the Git repo with the dbt project, for example,`https://uname:pass_or_token@github.com/organisation/repository.git`.
Use Data Source in splitgraph.yml
You can copy this into splitgraph.yml, or we'll generate it for you.

Developer-first

Use our splitgraph.yml format to check your Splitgraph configuration into version control, trigger ingestion jobs and manage your data stack like your code.

Get started
 
heart-icon

Why Splitgraph and Facebook Marketing?

Splitgraph connects your vast, unrelated data sources and puts them in a single, accessible place.

Unify your data stack

Splitgraph handles data integration, storage, transformation and discoverability for you. All that remains is adding a BI client.

Read more
 

Power your applications

Focus on building data-driven applications without worrying about where the data will come from.

heart-icon

Not just Data Source...

Splitgraph supports data ingestion from over 100 SaaS services, as well as data federation to over a dozen databases. These are all made queryable over a PostgreSQL-compatible interface.

heart-icon

Optimized for analytics

Splitgraph stores data in a columnar format. This accelerates analytical queries and makes it perfect for dashboards, blogs and other read-intensive use cases.

use-tools

Do more with Facebook Marketing?

heart-icon

Facebook Marketing on Splitgraph

Read more about Splitgraph’s support for Facebook Marketing, including its documentation and sample queries you can run on Facebook Marketing data with Splitgraph.

Facebook Marketing overview
 
heart-icon

Connecting to Splitgraph

Splitgraph has a PostgreSQL-compatible endpoint that most BI clients can connect to.

Try it out