Skip to content

Commit 270efac

Browse files
Merge pull request #23 from fivetran/fix/linkedin-ads-hierarchy
Fix/linkedin ads hierarchy
2 parents e7624a6 + b3af8db commit 270efac

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Include in your `packages.yml`
2929
```yaml
3030
packages:
3131
- package: fivetran/ad_reporting
32-
version: [">=0.3.0", "<0.4.0"]
32+
version: [">=0.4.0", "<0.5.0"]
3333
```
3434
3535
## Configuration

dbt_project.yml

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

55
require-dbt-version: [">=0.20.0"]
@@ -12,8 +12,6 @@ vars:
1212
ad_reporting__twitter_ads_enabled: true
1313
ad_reporting__facebook_ads_enabled: true
1414
ad_reporting__snapchat_ads_enabled: true
15-
dbt_utils_dispatch_list: ['spark_utils', 'fivetran_utils']
16-
fivetran_utils_dispatch_list: ['spark_utils']
1715

1816
models:
1917
ad_reporting:

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: '0.3.0'
2+
version: '0.4.0'
33
profile: 'integration_tests'
44
config-version: 2
55

models/ad_reporting.yml

+10-5
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,27 @@ version: 2
33
models:
44

55
- name: ad_reporting
6-
description: Each record in this table represents the daily performance of ads.
6+
description: >
7+
Each record in this table represents the daily performance of ads.
8+
9+
LinkedIn Ads has a slightly different hierarchy than the other marketing platforms. As identified within [Microsoft's Campaign Groups](https://docs.microsoft.com/en-us/linkedin/marketing/integrations/ads/account-structure/create-and-manage-campaign-groups?tabs=http)
10+
documentation, the hierarchy consists of multiple campaigns for a single campaign group. As this hierarchy is the inverse of the standard hierarchy seen within the
11+
other platforms, the `campaign` and `campaign_group` are switched for LinkedIn Ads within the ad_reporting table for consistency across platforms.
712
columns:
813
- name: campaign_name
9-
description: A label for the campaign.
14+
description: A label for the campaign. For LinkedIn Ads this field is the `campaign_group_name` field.
1015

1116
- name: ad_group_name
12-
description: A label for the ad group, if present in the source data. Mapped from fields including `campaign_group_name`.
17+
description: A label for the ad group, if present in the source data. Mapped from fields including `campaign_group_name`. For LinkedIn Ads this field is the `campaign_name` field.
1318

1419
- name: account_name
1520
description: A label for the account.
1621

1722
- name: campaign_id
18-
description: The ID representing the campaign.
23+
description: The ID representing the campaign. For LinkedIn Ads this field is the `campaign_group_id` field.
1924

2025
- name: ad_group_id
21-
description: The ID representing the ad group, if present in the source data. Mapped from fields including `campaign_group_id`.
26+
description: The ID representing the ad group, if present in the source data. Mapped from fields including `campaign_group_id`. For LinkedIn Ads this field is the `campaign_id` field.
2227

2328
- name: account_id
2429
description: The ID representing the account.

models/stg_linkedin_ads.sql

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ with base as (
1212
cast(date_day as date) as date_day,
1313
account_name,
1414
account_id,
15-
campaign_name,
16-
cast(campaign_id as {{ dbt_utils.type_string() }}) as campaign_id,
17-
campaign_group_name as ad_group_name,
18-
cast(campaign_group_id as {{ dbt_utils.type_string() }}) as ad_group_id,
15+
campaign_group_name as campaign_name,
16+
cast(campaign_group_id as {{ dbt_utils.type_string() }}) as campaign_id,
17+
campaign_name as ad_group_name,
18+
cast(campaign_id as {{ dbt_utils.type_string() }}) as ad_group_id,
1919
base_url,
2020
url_host,
2121
url_path,
@@ -33,4 +33,4 @@ with base as (
3333
)
3434

3535
select *
36-
from fields
36+
from fields

0 commit comments

Comments
 (0)