Meta Ads ingestion connector reference
This feature is in Beta. Workspace admins can control access to this feature from the Previews page. See Manage Databricks previews.
This page contains reference material for the Meta Ads ingestion connector in Databricks Lakeflow Connect.
Automatic data transformations
Databricks transforms Meta Ads data types to Delta-compatible data types as follows:
Meta Ads Type | Delta Type |
|---|---|
string | String |
int | Integer |
long | Long |
float | Float |
double | Double |
boolean | Boolean |
datetime | Timestamp |
date | Date |
list | Array |
map | Map |
enum | String |
Supported objects
The Meta Ads connector supports ingesting the following objects:
Object | Description |
|---|---|
ads | Individual ads in your campaigns |
ad_sets | Ad sets that group ads together with shared targeting, budget, and schedule settings |
campaigns | Top-level campaign objects that contain ad sets |
ad_images | Image assets used in ads |
ad_insights | Performance metrics and analytics data for ads, ad sets, campaigns, or accounts |
ad_creatives | Creative elements (images, videos, text) used in ads |
custom_audiences | Custom audience definitions for targeting |
ad_videos | Video assets used in ads |
custom_conversions | Custom conversion event definitions |
Prebuilt reports (21 tables) | Ready-made |
custom_report | User-defined insights report. Configure the report with |
ad_insights configuration options
The ad_insights object supports additional configuration options for analyzing performance data.
Start date
Set the earliest date from which to ingest historical ad_insights data. The Insights API only retains data for approximately 36 months, so start_date must be within the last 36 months. If unset, the connector defaults to 36 months before the current date.
Granularity levels
Specify the level at which to retrieve performance metrics:
account: Account-level metricscampaign: Campaign-level metricsadset: Ad set-level metricsad: Ad-level metrics (default)
Breakdown dimensions
Configure breakdown dimensions to segment performance data:
age: Age rangesgender: Gendercountry: Countryregion: Geographic regiondma: Designated Market Area (US only)device_platform: Device platform (mobile, desktop, etc.)placement: Ad placement locationpublisher_platform: Publisher platform (Facebook, Audience Network, etc.)impression_device: Device type for impressions
Action breakdown dimensions
Configure action breakdown dimensions to analyze conversion actions:
action_type: Type of conversion actionaction_destination: Destination of the conversion actionaction_carousel_card_id: Carousel card identifieraction_carousel_card_name: Carousel card nameaction_video_sound: Video sound settingaction_video_type: Video type
Time increment
Configure the aggregation period for ad_insights data:
all_days: A single bucket covering the full time range (Insights API default).monthly: One bucket per calendar month.- An integer number of days as a string (for example,
"1"for daily buckets,"7"for weekly buckets).
The Insights API doesn't support hourly time increments.
Action report time
Configure the timestamp used to report action statistics:
impression: Conversions are reported on the date of the impression that drove them.conversion: Conversions are reported on the date the conversion occurred.mixed: Click-through conversions use impression time, view-through conversions use conversion time.lifetime: Lifetime conversions for the entity.
Attribution windows
Configure attribution windows for the actions.
1d_click,7d_click: Click-through attribution windows1d_view: View-through attribution window7d_view,28d_view: View-through attribution windows. Deprecated by Meta and no longer supported by the connector.
You can specify multiple values (for example, ["7d_click", "1d_view"]). If action_attribution_windows isn't set, the connector uses your Meta Ads account's default attribution settings. For a list of values, see Meta's Insights API reference.
Lookback window
Configure how far back the connector reingests data (in days) on each sync. The lookback window applies to ad_insights, custom_report, and prebuilt reports. If unset, it defaults to 7 days.
- Time-range re-ingestion: On each sync after the first, the connector pulls data for
[last_sync_cursor - <N> days, today]so late-arriving conversions are captured. Ifcustom_insights_lookback_windowis unset, the connector reingests the last7days by default. - Attribution fallback: When you set
custom_insights_lookback_windowexplicitly and you have not setaction_attribution_windows, the connector also passes<N>d_click,1d_viewas the attribution window to the Insights API. To control attribution independently of the lookback, setaction_attribution_windows.
Prebuilt reports
Prebuilt reports are ready-to-use ad_insights variants. Each prebuilt report issues a Meta /insights call with a fixed level, breakdown, and action-breakdown combination — no configuration is required. Unlike ad_insights, prebuilt reports are not configurable.
To ingest a prebuilt report, set source_table to the report name. connector_options are optional. A prebuilt report runs with none (using the defaults), but you can set start_date in meta_ads_options to control the date range.
Available prebuilt reports
Each prebuilt report maps to a fixed Meta /insights request.
Report ( | Category | Level | Breakdowns | Action breakdowns | Metric set |
|---|---|---|---|---|---|
| Basic |
| — |
| Core metrics |
| Basic |
| — |
| Core metrics |
| Basic |
| — |
| Core metrics |
| Basic |
| — |
| Core metrics (with ad, ad set, campaign names) |
| Delivery |
|
|
| Core metrics |
| Delivery |
|
|
| Core metrics |
| Delivery |
|
|
| Core metrics |
| Delivery |
| — |
| Conversion / ROAS |
| Demographics |
|
|
| Core metrics |
| Demographics |
|
|
| Core metrics |
| Demographics |
|
|
| Core metrics |
| Demographics |
|
|
| Core metrics |
| Demographics |
|
|
| Core metrics |
| Demographics |
|
|
| Core metrics |
| Action |
| — |
| Conversion / ROAS |
| Action |
| — |
| Conversion / ROAS |
| Action |
|
|
| Conversion / ROAS |
| Action |
|
|
| Conversion / ROAS |
| Action |
| — |
|
|
| Action |
| — |
| Video engagement |
| Action |
| — |
| Video engagement |
Each prebuilt report uses one of three metric sets, which determine the columns included in the output:
Metric set | Columns |
|---|---|
Core metrics |
|
Conversion / ROAS |
|
Video engagement |
|
Output columns
Every prebuilt report row includes date_start, date_stop, account_id, the report's entity and hierarchy columns (for example ad_id, adset_id, campaign_id, and names where applicable), any breakdown column (for example age, device_platform), the derived breakdown_hash, and the primary key insight_id. The metric columns depend on the report's metric set. Action and ROAS columns are typed as array<string>.
Prebuilt report behavior
- Each row is uniquely identified by
insight_id. The connector syncs data incrementally, usingdate_stopas the cursor. - The report configuration —
level,breakdowns,action_breakdowns,time_increment(daily), attribution windows (7d_click,1d_view), andaction_report_time(mixed) — is fixed per report and cannot be overridden usingmeta_ads_options. - You can optionally set
start_date(default: 36 months before today) andcustom_insights_lookback_window(default: 7 days) inmeta_ads_options.
custom_report configuration options
custom_report lets you define your own ad_insights-style report with a custom level, breakdown, and action-breakdown combination and ingest it into a table you name. Use it when no prebuilt report matches your needs and you want full control over the /insights configuration.
To ingest a custom report, set source_table to custom_report, choose a destination_table name, and configure the report under connector_options.meta_ads_options.custom_report_options. You can add multiple custom_report objects to one pipeline, each with a distinct destination_table.
Object structure:
{
"table": {
"source_schema": "<meta-ads-account-id>",
"source_table": "custom_report",
"destination_catalog": "<catalog>",
"destination_schema": "<schema>",
"destination_table": "<your-report-name>",
"connector_options": {
"meta_ads_options": {
"start_date": "<YYYY-MM-DD>",
"custom_insights_lookback_window": 7,
"custom_report_options": {
"level": "ad",
"breakdowns": ["country"],
"action_breakdowns": ["action_type"],
"time_increment": "1",
"action_report_time": "mixed",
"action_attribution_windows": ["7d_click", "1d_view"]
}
}
}
}
}
custom_report_options
Each option mirrors the corresponding ad_insights option:
Option | Description |
|---|---|
| Granularity: |
| Dimensions that segment all metrics (for example, |
| Dimensions that segment action/conversion metrics (for example, |
| Aggregation period: |
| When actions are counted: |
| Attribution windows for actions (for example, |
Shared meta_ads_options
Option | Description | Default when unset |
|---|---|---|
| Earliest date to ingest, YYYY-MM-DD. | 36 months before the current date |
| Number of days to re-ingest on each subsequent sync (captures late conversions). | 7 days |
You must set destination_table on the table object so multiple custom reports can coexist in one pipeline.
Each row is uniquely identified by insight_id. The connector syncs data incrementally, using date_stop as the cursor.
API versions
The Meta Ads connector uses the Meta Marketing API (Graph API). Databricks keeps the connector up to date with the latest stable API version.