Skip to content

Instantly share code, notes, and snippets.

@mattm
Last active October 1, 2018 19:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattm/bbeff1ec71ddd663ca83ff476a71b41d to your computer and use it in GitHub Desktop.
Save mattm/bbeff1ec71ddd663ca83ff476a71b41d to your computer and use it in GitHub Desktop.
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