Facebook Ads model

Conversion Insights

This SQL template retrieves conversion insights data from Facebook Ads, including various metrics such as spend, reach, impressions, clicks, and more. It joins data from different tables like ad_insight, ad, and ad_roas_insight_conversion_insights to provide a comprehensive analysis of ad performance.

Grain
See the notes
Built from
  1. 3
    Raw tables
  2. 1
    Core
  3. 1
    Analytics
Reads from Facebook Ads
adad_insightad_roas_insight_conversion_insights
Ships as
Weld and dbt SQL, open source on GitHub
core.facebook_ads.conversion_insights
1-- core.facebook_ads.conversion_insights
2-- Conversion Insights. This SQL template retrieves conversion insights data from
3-- Facebook Ads, including various metrics such as spend, reach, impressions,
4-- clicks, and more. It joins data from different tables like ad_insight, ad, and
5-- ad_roas_insight_conversion_insights to provide a comprehensive analysis of ad
6-- performance.
7--
8-- From the weld.app template library. Not reconciled against Facebook Ads;
9-- check the output against the source before relying on it.
10
11with
12    stats as (
13        select
14            *
15        from
16            {{raw.facebook_ads.ad_insight}}
17    )
18  , ad as (
19        select
20            *
21        from
22            {{raw.facebook_ads.ad}}
23    ),
24    action_data as (
25        select
26            *
27        except
28        (
29            account_id
30          , account_name
31          , account_currency
32          , campaign_id
33          , adset_id
34        )
35        from
36            {{raw.facebook_ads.ad_roas_insight_conversion_insights}}
37    )
38select
39    cast(stats.date as date) date_day
40  , stats.account_id account_id

This model and the 1 it depends on. Deploy them together; refs like {{staging.…}} resolve to the matching folders in Weld, and the dbt view uses source() and ref().

Notes

How it counts. And where it stops.

"Conversion Insights" is designed to provide valuable insights from Facebook Ads data integration. It retrieves various statistics related to ad performance, such as spend, reach, impressions, clicks, and more. By joining different tables, it allows for analyzing conversion insights by date, account, campaign, ad set, and ad levels. This SQL can be useful for tracking the effectiveness of Facebook ad campaigns, optimizing bidding strategies, and understanding user actions leading to conversions.

Raw tables it reads

  • raw.facebook_ads.ad
  • raw.facebook_ads.ad_insight
  • raw.facebook_ads.ad_roas_insight_conversion_insights

Put Facebook Ads in front
of your agents.

Connect Facebook Ads, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.