LinkedIn Ads model
Campaign performance daily
Daily campaign performance with the rates Campaign Manager shows: CTR, CPC, CPM, cost per conversion, ROAS and cost per lead.
- Grain
- date_day x account_id x campaign_id
- Built from
- 5Raw tables
- 5Staging
- 2Core
- 1Analytics
- Reads from LinkedIn Ads
- accountad_analytics_by_creativecampaigncampaign_groupcreative
- Ships as
- Weld and dbt SQL, open source on GitHub
core.linkedin_ads.campaign_performance_daily
1-- core.linkedin_ads.campaign_performance_daily
2-- Daily campaign performance with the rates Campaign Manager shows: CTR, CPC, CPM,
3-- cost per conversion, ROAS and cost per lead.
4--
5-- Grain: date_day x account_id x campaign_id. Currency: the ad account's.
6-- Depends on: core.linkedin_ads.ad_performance_daily
7--
8-- Built by summing creatives, so it uses the same conversion definition: external
9-- website conversions (post-click plus post-view, per conversion rule windows),
10-- with Lead Gen Form leads kept apart in `leads`.
11--
12-- Rates are ratios of sums at this grain; never average the daily rates.
13
14SELECT
15 date_day,
16 account_id,
17 account_name,
18 currency,
19 campaign_id,
20 campaign_name,
21 campaign_group_id,
22 campaign_group_name,
23 campaign_objective,
24
25 SUM(spend) AS spend,
26 SUM(impressions) AS impressions,
27 SUM(clicks) AS clicks,
28 SUM(conversions) AS conversions,
29 SUM(conversion_value) AS conversion_value,
30
31 SAFE_DIVIDE(SUM(clicks), SUM(impressions)) AS ctr,
32 SAFE_DIVIDE(SUM(spend), SUM(clicks)) AS cpc,
33 SAFE_DIVIDE(SUM(spend), SUM(impressions)) * 1000 AS cpm,
34 SAFE_DIVIDE(SUM(spend), SUM(conversions)) AS cost_per_conversion,
35 SAFE_DIVIDE(SUM(conversion_value), SUM(spend)) AS roas,
36
37 'linkedin_ads' AS source,
38 SUM(spend_usd) AS spend_usd,
39 SUM(landing_page_clicks) AS landing_page_clicks,
40 SUM(leads) AS leads,This model and the 7 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.
Built by summing creatives, so it uses the same conversion definition: external website conversions (post-click plus post-view, per conversion rule windows), with Lead Gen Form leads kept apart in `leads`. Rates are ratios of sums at this grain; never average the daily rates.
Raw tables it reads
- raw.linkedin_ads.account
- raw.linkedin_ads.ad_analytics_by_creative
- raw.linkedin_ads.campaign
- raw.linkedin_ads.campaign_group
- raw.linkedin_ads.creative
More LinkedIn Ads models
Put LinkedIn Ads in front
of your agents.
Connect LinkedIn Ads, deploy the models, and ask questions in Claude, Cursor or ChatGPT. Free for 14 days, no credit card.