Skip to content

Instantly share code, notes, and snippets.

@mattm
Last active October 1, 2018 19:28
Embed
What would you like to do?
Facebook Ad Insights Spend
select
campaign_id,
sum(spend) as total_spend,
sum(impressions) as total_impressions,
sum(spend) / sum(impressions) * 1000 as cpm,
sum(inline_link_clicks) as link_clicks,
sum(inline_link_clicks) / sum(impressions) as ctr
from facebook_ad_insights.ad_insights
where date = '2018-10-01'
group by 1
order by 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment