Skip to content

Commit 2146d06

Browse files
Merge pull request #61 from fivetran/release/v1.0.1
release/v1.0.1
2 parents 1c66169 + 512f2c7 commit 2146d06

File tree

7 files changed

+272
-10
lines changed

7 files changed

+272
-10
lines changed

CHANGELOG.md

+17
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
# dbt_ad_reporting v1.0.1
2+
3+
## 🎉 Feature Enhancements 🎉
4+
[PR #57](https://github.com/fivetran/dbt_ad_reporting/pull/57) incorporates the following change:
5+
- The package now includes a set of pre-defined [metrics](https://docs.getdbt.com/docs/building-a-dbt-project/metrics) related to clicks, impressions, and spend (definitions [here](https://github.com/fivetran/dbt_ad_reporting/blob/main/models/ad_reporting_metrics.yml)).
6+
- Refer to the [README](https://github.com/fivetran/dbt_ad_reporting#optional-step-8-use-predefined-metrics) for the included metrics and instructions on how to use them.
7+
- Note: This requires you to manually add a dependency on the [dbt metrics package](https://github.com/dbt-labs/dbt_metrics) to use.
8+
9+
## Fixes
10+
[PR #60](https://github.com/fivetran/dbt_ad_reporting/pull/60) incorporates the following change:
11+
- The LinkedIn Ads schema and database variables were incorrectly documented within the README. The README has been updated to reflect the correct variable names.
12+
- `linkedin_schema` has been properly updated to reflect `linkedin_ads_schema`
13+
- `linkedin_database` has been updated to reflect `linkedin_ads_database`.
14+
15+
## Contributors
16+
- [@clay-walker](https://github.com/clay-walker) ([#60](https://github.com/fivetran/dbt_ad_reporting/pull/60))
17+
118
# dbt_ad_reporting v1.0.0
219
## 🚨 Breaking Changes 🚨
320
[PR #54](https://github.com/fivetran/dbt_ad_reporting/pull/54) incorporates these breaking changes:

README.md

+46-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ vars:
8181
microsoft_ads_schema: bingads
8282
microsoft_ads_database: your_database_name
8383
84-
linkedin_schema: linkedin_ads
85-
linkedin_database: your_database_name
84+
linkedin_ads_schema: linkedin_ads
85+
linkedin_ads_database: your_database_name
8686
8787
pinterest_schema: pinterest
8888
pinterest_database: your_database_name
@@ -209,6 +209,50 @@ Fivetran offers the ability for you to orchestrate your dbt project through [Fiv
209209
</details>
210210
<br>
211211

212+
## (Optional) Step 8: Use predefined Metrics
213+
<details><summary>Expand for details</summary>
214+
215+
On top of the `ad_reporting__ad_report` final model, the Ad Reporting dbt package defines common [Metrics](https://docs.getdbt.com/docs/building-a-dbt-project/metrics), including:
216+
- Spend
217+
- Impressions
218+
- Clicks
219+
- Cost per click
220+
- Clickthrough rate
221+
- Bounce rate
222+
- Count of active ads
223+
- Average spend
224+
- Average non-zero spend
225+
226+
You can find the supported dimensions and full definitions of these metrics [here](https://github.com/fivetran/dbt_ad_reporting/blob/main/models/ad_reporting_metrics.yml).
227+
228+
To use dbt Metrics, add the [dbt metrics package](https://github.com/dbt-labs/dbt_metrics) to your project's `packages.yml` file:
229+
```yml
230+
packages:
231+
- package: dbt-labs/metrics
232+
version: [">=0.3.0", "<0.4.0"]
233+
```
234+
> **Note**: The Metrics package has stricter dbt version requirements. As of today, the latest version of Metrics (v0.3.5) requires dbt `[">=1.2.0-a1", "<2.0.0"]`.
235+
236+
To utilize the Ad Reporting's pre-defined metrics in your code, refer to the [dbt metrics package](https://github.com/dbt-labs/dbt_metrics) usage instructions and the example below:
237+
```sql
238+
select *
239+
from {{ metrics.calculate(
240+
metric('clicks'),
241+
grain='month',
242+
dimensions=['platform',
243+
'campaign_id',
244+
'campaign_name'
245+
],
246+
secondary_calculations=[
247+
metrics.period_over_period(comparison_strategy='difference', interval=1, alias='diff_last_mth'),
248+
metrics.period_over_period(comparison_strategy='ratio', interval=1, alias='ratio_last_mth')
249+
]
250+
) }}
251+
```
252+
253+
</details>
254+
<br>
255+
212256
# 🔍 Does this package have dependencies?
213257
This dbt package is dependent on the following dbt packages. For more information on the below packages, refer to the [dbt hub](https://hub.getdbt.com/) site.
214258
> **If you have any of these dependent packages in your own `packages.yml` I highly recommend you remove them to ensure there are no package version conflicts.**

dbt_project.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'ad_reporting'
2-
version: '1.0.0'
2+
version: '1.0.1'
33
config-version: 2
44

55
require-dbt-version: [">=1.0.0", "<2.0.0"]

integration_tests/dbt_project.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: 'ad_reporting_integration_tests'
2-
version: '1.0.0'
2+
version: '1.0.1'
33
profile: 'integration_tests'
44
config-version: 2
55

integration_tests/requirements.txt

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
dbt-snowflake~=1.0.0
2-
dbt-bigquery~=1.0.0
3-
dbt-redshift~=1.0.0
4-
dbt-postgres~=1.0.0
5-
dbt-spark~=1.0.0
6-
dbt-spark[PyHive]~=1.0.0
1+
dbt-snowflake>=1.0.0
2+
dbt-bigquery>=1.0.0
3+
dbt-redshift>=1.0.0
4+
dbt-postgres>=1.0.0
5+
dbt-spark>=1.0.0
6+
dbt-spark[PyHive]>=1.0.0

models/ad_reporting_metrics.yml

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
version: 2
2+
3+
metrics:
4+
- name: spend
5+
label: Ad spend (Fivetran)
6+
model: ref('ad_reporting__ad_report')
7+
8+
type: sum
9+
sql: spend
10+
description: Total spend (in currency of individual platforms)
11+
12+
timestamp: date_day
13+
time_grains: [day, week, month]
14+
15+
dimensions:
16+
- platform
17+
- campaign_id
18+
- campaign_name
19+
- ad_group_id
20+
- ad_group_name
21+
- ad_id
22+
- ad_name
23+
- account_id
24+
- account_name
25+
26+
- name: clicks
27+
label: Ad clicks (Fivetran)
28+
model: ref('ad_reporting__ad_report')
29+
30+
type: sum
31+
sql: clicks
32+
description: Total clicks
33+
34+
timestamp: date_day
35+
time_grains: [day, week, month]
36+
37+
dimensions:
38+
- platform
39+
- campaign_id
40+
- campaign_name
41+
- ad_group_id
42+
- ad_group_name
43+
- ad_id
44+
- ad_name
45+
- account_id
46+
- account_name
47+
48+
- name: impressions
49+
label: Ad impressions (Fivetran)
50+
model: ref('ad_reporting__ad_report')
51+
description: Total impressions
52+
53+
type: sum
54+
sql: impressions
55+
56+
timestamp: date_day
57+
time_grains: [day, week, month]
58+
59+
dimensions:
60+
- platform
61+
- campaign_id
62+
- campaign_name
63+
- ad_group_id
64+
- ad_group_name
65+
- ad_id
66+
- ad_name
67+
- account_id
68+
- account_name
69+
70+
- name: cost_per_click
71+
label: Average ad cost per click (Fivetran)
72+
description: The ratio of spend to clicks
73+
74+
type: expression
75+
sql: "{{ metric('spend') }} / {{ metric('clicks') }}"
76+
77+
timestamp: date_day
78+
time_grains: [day, week, month]
79+
80+
dimensions:
81+
- platform
82+
- campaign_id
83+
- campaign_name
84+
- ad_group_id
85+
- ad_group_name
86+
- ad_id
87+
- ad_name
88+
- account_id
89+
- account_name
90+
91+
- name: bounce_rate
92+
label: Average Ad Bounce Rate (Fivetran)
93+
description: Percentage of impressions that did not convert into clicks.
94+
95+
type: expression
96+
sql: "({{ metric('impressions') }} - {{ metric('clicks') }}) / {{ metric('impressions') }}"
97+
98+
timestamp: date_day
99+
time_grains: [day, week, month]
100+
101+
dimensions:
102+
- platform
103+
- campaign_id
104+
- campaign_name
105+
- ad_group_id
106+
- ad_group_name
107+
- ad_id
108+
- ad_name
109+
- account_id
110+
- account_name
111+
112+
- name: clickthrough_rate
113+
label: Ad Clickthrough Rate (Fivetran)
114+
description: Percentage of impressions that did convert into clicks.
115+
116+
type: expression
117+
sql: "{{ metric('clicks') }} / {{ metric('impressions') }}"
118+
119+
timestamp: date_day
120+
time_grains: [day, week, month]
121+
122+
dimensions:
123+
- platform
124+
- campaign_id
125+
- campaign_name
126+
- ad_group_id
127+
- ad_group_name
128+
- ad_id
129+
- ad_name
130+
- account_id
131+
- account_name
132+
133+
- name: active_ads
134+
label: Count of Active Ads (Fivetran)
135+
model: ref('ad_reporting__ad_report')
136+
description: Count of ads witth spend > 0.
137+
138+
type: count_distinct
139+
sql: ad_id
140+
141+
timestamp: date_day
142+
time_grains: [day, week, month]
143+
144+
dimensions:
145+
- platform
146+
- campaign_id
147+
- campaign_name
148+
- ad_group_id
149+
- ad_group_name
150+
- account_id
151+
- account_name
152+
153+
filters:
154+
- field: spend
155+
operator: '>'
156+
value: '0'
157+
158+
- name: avg_spend_nonzero
159+
label: Average Spend, Ignore Zeros (Fivetran)
160+
model: ref('ad_reporting__ad_report')
161+
description: Average ad spend, ignores zero-spend days.
162+
163+
type: average
164+
sql: spend
165+
166+
timestamp: date_day
167+
time_grains: [week, month]
168+
169+
dimensions:
170+
- platform
171+
- campaign_id
172+
- campaign_name
173+
- ad_group_id
174+
- ad_group_name
175+
- account_id
176+
- account_name
177+
178+
filters:
179+
- field: spend
180+
operator: '>'
181+
value: '0'
182+
183+
- name: avg_spend
184+
label: Average Spend (Fivetran)
185+
model: ref('ad_reporting__ad_report')
186+
description: Average ad spend, does not ignore zero-spend days.
187+
188+
type: average
189+
sql: spend
190+
191+
timestamp: date_day
192+
time_grains: [week, month]
193+
194+
dimensions:
195+
- platform
196+
- campaign_id
197+
- campaign_name
198+
- ad_group_id
199+
- ad_group_name
200+
- account_id
201+
- account_name
File renamed without changes.

0 commit comments

Comments
 (0)