Optional - Configuring Channel Group Classification
By default, the Attribution Package uses the channel grouping set within the Unified Package. It is recommended to set the channel grouping within the Unified Package, so you have matching channel groups across both packages.
Optionally, you can choose to have differing channel groupings within the Attribution Package by customizing the macro only within the Attribution Package.
Configuring within the Unified Package
- Create a new file called
channel_group_query.sql
in your root dbt projects macro folder
- Open this link to find the GitHub link to the channel_group_query.sql macro within Unified Package. Within the file there are three macros, find the one relevant to you:
- bigquery__channel_group_query - BigQuery
- redshift__channel_group_query - Redshift
- default__channel_group_query - Any other Data Warehouse or Query Engine
- Copy the relevant macro into the file you created within step 1. Ensure you copy the full macro.
{% macro default__channel_group_query() %}
...
{% endmacro %}
- Customize the
CASE
statement to capture your requirements. For example, you may want to setUnassigned
to be calledDirect
.
CASE
...
else 'Direct'
END
- Next time you run the Unified Package the macro you created will be prioritized over the built-in package macro.
Configuring within the Attribution Package
- Create a new file called
channel_classification.sql
in your root dbt projects macro folder
- Paste the following into the file you created within step 1.
{% macro default__channel_classification() %}
default_channel_group
{% endmacro %}
Customize the macro to capture your requirements. See the example below on how you may want to set traffic to the channel
Unassigned
to be calledDirect
.The
default_channel_group
field is from the Unified Package.
{% macro default__channel_classification() %}
CASE
WHEN default_channel_group = 'Unassigned' THEN 'Direct'
ELSE default_channel_group
END
{% endmacro %}
- Next time you run the Attribution Package the macro you created will be prioritized over the built-in package macro.