-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
245 additions
and
397 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
base url | ||
url host | ||
url path | ||
utm source | ||
utm meidum | ||
utm campaign | ||
utm content | ||
utm term | ||
*/ | ||
|
||
with ads as ( | ||
select | ||
created_at_timestamp as date_day, | ||
account_id, | ||
account_name, | ||
campaign_id, | ||
campaign_name, | ||
adset_id, | ||
adset_name, | ||
ad_id, | ||
ad_name, | ||
account_id, | ||
impressions, | ||
clicks, | ||
spend | ||
from {{ ref('stg_facebook_ads_ads') }} | ||
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
date_day, | ||
account_id, | ||
account_name, | ||
campaign_id, | ||
campaign_name, | ||
adset_id, | ||
adset_name, | ||
clicks, | ||
impressions, | ||
spend | ||
*/ | ||
|
||
with ads as ( | ||
select | ||
ad_id, | ||
ad_name, | ||
adset_id, | ||
account_id, | ||
account_name | ||
campaign_id, | ||
campaign_name, | ||
created_at_timestamp, | ||
spend, | ||
clicks, | ||
impressions | ||
from {{ ref('stg_facebook_ads_ads') }} | ||
), | ||
|
||
adset as ( | ||
select | ||
ads.created_at_timestamp, | ||
ads.adset_id, | ||
ads.adset_name, | ||
ads.campaign_id, | ||
ads.campaign_name, | ||
ads.account_id, | ||
ads.account_name, | ||
sum(ads.spend), | ||
sum(ads.clicks), | ||
sum(ads.impressions) | ||
from campaigns | ||
left join ads using (campaign_id) and (created_at_timestamp) | ||
{{ dbt_utils.group_by(n=6) }} | ||
) | ||
|
||
select * from final_campaigns |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/* | ||
date_day, | ||
account_id, | ||
account_name, | ||
campaign_id, | ||
campaign_name, | ||
clicks, | ||
impressions, | ||
spend | ||
*/ | ||
|
||
with campaigns as ( | ||
select | ||
id as campaign_id, | ||
name as campaign_name, | ||
objective, | ||
account_id, | ||
created_time as created_at_timestamp | ||
from {{ ref('stg_facebook_ads_campaigns') }} | ||
), | ||
|
||
ads as ( | ||
select | ||
ad_id, | ||
ad_name, | ||
adset_id, | ||
account_id, | ||
account_name | ||
campaign_id, | ||
campaign_name, | ||
created_at_timestamp, | ||
spend, | ||
clicks, | ||
impressions | ||
from {{ ref('stg_facebook_ads_ads') }} | ||
), | ||
|
||
final_campaigns as ( | ||
select | ||
campaigns.created_at_timestamp, | ||
campaigns.campaign_id, | ||
campaigns.campaign_name, | ||
campaigns.account_id, | ||
ads.account_name, | ||
campaigns.objective, | ||
sum(ads.spend), | ||
sum(ads.clicks), | ||
sum(ads.impressions) | ||
from campaigns | ||
left join ads using (campaign_id) and (created_at_timestamp) | ||
{{ dbt_utils.group_by(n=6) }} | ||
) | ||
|
||
select * from final_campaigns |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.