For the complete documentation index, see llms.txt. This page is also available as Markdown.

Channel Attribution Data Mart Code

This page provides information on the transform code block that is needed to create Channel Attribution Data Mart and what should be added to a Script Manifest file in order to execute the code

Workflows

Upstream Data Mart Dependencies

The proper sequence of either a Workflow or position in a Script Manifest file to populate this Data Mart is highlighted in the Transform Code Sequence - Data Mart page

Script Manifest File (YML)

Transformation Code Requirements

The following code should be added in the Script Manifest file

  order_channel_stg:
    integrations:
      - google_analytics
    scripts:
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/000_CHN_BAS_reset_order_attribution.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/001_CHN_BAS_table_creation.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/003_CHN_BAS_temp_uts_multi_channel_funnel.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/005_CHN_BAS_stg_orders_update_list.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/110_CHN_BAS_stg_ga_last_click_raw.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/120_CHN_BAS_stg_ga_last_click.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/130_CHN_BAS_stg_first_click.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/140_CHN_BAS_stg_first_ad_click.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/150_CHN_BAS_stg_last_ad_click.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/160_CHN_BAS_stg_first_mktg_click.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/170_CHN_BAS_stg_last_mktg_click.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/180_CHN_BAS_stg_discount_code_channel.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/190_CHN_BAS_stg_order_attribution_detail.sql"

  order_attribution_enquire:
    integrations:
      - enquire_labs
    scripts:
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/200_CHN_BAS_stg_self_reported_channel.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/201_CHN_BAS_stg_order_attribution_detail_insert_enquire.sql"

  order_channel_attribution:
    integrations:
      - google_analytics
    scripts:
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/210_CHN_BAS_stg_merchant_attribution.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/220_CHN_BAS_stg_order_attribution_detail_insert_ma.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/230_CHN_BAS_order_attribution_detail.sql"
      - "github://platform-sql-shared/scripts/datamart/13_channel_attribution/240_CHN_BAS_order_attribution.sql"

Order Channel

Order Channel Staging

Enable this code if you need to reset the order attribution:

Create the final Order Channel tables

Determine the orders and channel for each of the attribution methods:

Fairing Order Attribution

Add self-reported (survey) attribution if Fairing is enabled as an extractor. Use the block that matches the merchant's Fairing integration version.

Fairing V2 (current):

Fairing V1 / Enquire Labs (legacy):

Note: New merchants connecting Fairing should use the V2 integration (fairing_v2). The legacy enquire_labs block is documented here only for existing merchants who connected before Fairing V2 was available.

Order Attribution

Build the final attribution tables

Last updated

Was this helpful?