Skip to content

Commit

Permalink
Merge pull request #23 from fivetran/fix/linkedin-ads-hierarchy
Browse files Browse the repository at this point in the history
Fix/linkedin ads hierarchy
  • Loading branch information
fivetran-joemarkiewicz authored Aug 19, 2021
2 parents e7624a6 + b3af8db commit 270efac
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Include in your `packages.yml`
```yaml
packages:
- package: fivetran/ad_reporting
version: [">=0.3.0", "<0.4.0"]
version: [">=0.4.0", "<0.5.0"]
```
## Configuration
Expand Down
4 changes: 1 addition & 3 deletions dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'ad_reporting'
version: '0.3.0'
version: '0.4.0'
config-version: 2

require-dbt-version: [">=0.20.0"]
Expand All @@ -12,8 +12,6 @@ vars:
ad_reporting__twitter_ads_enabled: true
ad_reporting__facebook_ads_enabled: true
ad_reporting__snapchat_ads_enabled: true
dbt_utils_dispatch_list: ['spark_utils', 'fivetran_utils']
fivetran_utils_dispatch_list: ['spark_utils']

models:
ad_reporting:
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/dbt_project.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'ad_reporting_integration_tests'
version: '0.3.0'
version: '0.4.0'
profile: 'integration_tests'
config-version: 2

Expand Down
15 changes: 10 additions & 5 deletions models/ad_reporting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,27 @@ version: 2
models:

- name: ad_reporting
description: Each record in this table represents the daily performance of ads.
description: >
Each record in this table represents the daily performance of ads.
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)
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
other platforms, the `campaign` and `campaign_group` are switched for LinkedIn Ads within the ad_reporting table for consistency across platforms.
columns:
- name: campaign_name
description: A label for the campaign.
description: A label for the campaign. For LinkedIn Ads this field is the `campaign_group_name` field.

- name: ad_group_name
description: A label for the ad group, if present in the source data. Mapped from fields including `campaign_group_name`.
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.

- name: account_name
description: A label for the account.

- name: campaign_id
description: The ID representing the campaign.
description: The ID representing the campaign. For LinkedIn Ads this field is the `campaign_group_id` field.

- name: ad_group_id
description: The ID representing the ad group, if present in the source data. Mapped from fields including `campaign_group_id`.
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.

- name: account_id
description: The ID representing the account.
Expand Down
10 changes: 5 additions & 5 deletions models/stg_linkedin_ads.sql
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ with base as (
cast(date_day as date) as date_day,
account_name,
account_id,
campaign_name,
cast(campaign_id as {{ dbt_utils.type_string() }}) as campaign_id,
campaign_group_name as ad_group_name,
cast(campaign_group_id as {{ dbt_utils.type_string() }}) as ad_group_id,
campaign_group_name as campaign_name,
cast(campaign_group_id as {{ dbt_utils.type_string() }}) as campaign_id,
campaign_name as ad_group_name,
cast(campaign_id as {{ dbt_utils.type_string() }}) as ad_group_id,
base_url,
url_host,
url_path,
Expand All @@ -33,4 +33,4 @@ with base as (
)

select *
from fields
from fields

0 comments on commit 270efac

Please sign in to comment.