LinkedIn Ads model
Campaign group performance daily
Daily performance per campaign group. Campaign groups hold the shared budget and schedule on LinkedIn, so this is the level many teams plan and pace spend at.
- Grain
- date_day x account_id x campaign_group_id
- Built from
- 5Raw tables
- 5Staging
- 3Core
- 1Analytics
- Reads from LinkedIn Ads
- accountad_analytics_by_creativecampaigncampaign_groupcreative
- Ships as
- Weld and dbt SQL, open source on GitHub
core.linkedin_ads.campaign_group_performance_daily
1-- core.linkedin_ads.campaign_group_performance_daily
2-- Daily performance per campaign group. Campaign groups hold the shared budget and
3-- schedule on LinkedIn, so this is the level many teams plan and pace spend at.
4--
5-- Grain: date_day x account_id x campaign_group_id. Currency: the ad account's.
6-- Depends on: core.linkedin_ads.campaign_performance_daily
7--
8-- Same conversion definition as the campaign model: external website conversions,
9-- with Lead Gen Form leads in `leads`. Rates are ratios of sums at this grain.
10
11SELECT
12 date_day,
13 account_id,
14 account_name,
15 currency,
16 campaign_group_id,
17 campaign_group_name,
18
19 SUM(spend) AS spend,
20 SUM(impressions) AS impressions,
21 SUM(clicks) AS clicks,
22 SUM(conversions) AS conversions,
23 SUM(conversion_value) AS conversion_value,
24 SUM(leads) AS leads,
25 COUNT(DISTINCT IF(impressions > 0, campaign_id, NULL)) AS campaigns_with_impressions,
26
27 SAFE_DIVIDE(SUM(clicks), SUM(impressions)) AS ctr,
28 SAFE_DIVIDE(SUM(spend), SUM(clicks)) AS cpc,
29 SAFE_DIVIDE(SUM(spend), SUM(impressions)) * 1000 AS cpm,
30 SAFE_DIVIDE(SUM(spend), SUM(conversions)) AS cost_per_conversion,
31 SAFE_DIVIDE(SUM(conversion_value), SUM(spend)) AS roas,
32 SAFE_DIVIDE(SUM(spend), SUM(leads)) AS cost_per_lead
33FROM {{core.linkedin_ads.campaign_performance_daily}}
34GROUP BY 1, 2, 3, 4, 5, 6This model and the 8 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.
Same conversion definition as the campaign model: external website conversions, with Lead Gen Form leads in `leads`. Rates are ratios of sums at this grain.
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.