--- account insights by gender


DROP VIEW IF EXISTS account_insights_by_device CASCADE;

CREATE VIEW account_insights_by_device AS
SELECT 
    time, 
    account_id, 
    device_platform, 
    SUM(impressions) AS impressions, 
    SUM(clicks) AS clicks,
    SUM(spend) AS spend, 
    SUM(link_click) AS link_click, 
    SUM(landing_page_view) AS landing_page_view,
    SUM(lead) AS lead
FROM campaign_insights_by_device_flattened
GROUP BY time, account_id, device_platform;


