> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sourcemedium.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# MTA Attribution Rules

> The rules that decide which touches get credit: email and SMS, brand campaigns, and channel-level ad spend

Three rules change which touches receive credit. They apply in the warehouse tables and in the MTA dashboard alike. The general validity rules are in the [MTA overview](/docs/mta/mta-overview).

## Email and SMS

**Rule:** Email and SMS touches never receive first-touch or linear credit in the marketing channel, ad, campaign, or ad group dimensions. They receive last-touch credit in those dimensions only when that option is enabled for your account. It is off by default. Ask your SourceMedium contact to enable it.

A customer must already know your brand to be on your list, so a message is rarely the true first touch. Frequent sends would also take a large share of linear credit away from the channels that brought the customer in.

What this means for the numbers:

* First touch goes to the earliest valid touch that is not email or SMS.
* Linear credit is split only among the touches that are not email or SMS.
* A journey whose only touches are email or SMS is not attributable in these dimensions. It shows as non-attributable in the dashboard.

Email and SMS get their own dimension, `email_sms`, with first-touch, last-touch, and linear credit computed on email and SMS touches alone. The dimension value is formatted `[Email][Flow] Welcome Series` or `[SMS][Campaign] Flash Sale`. It combines the channel, whether the message is a flow or a campaign, and a name. The name comes from `utm_campaign`, else `utm_content`, else `utm_term`, else `utm_id`.

Messages that appear in the most purchase journeys, with their last-touch revenue in the email/SMS dimension:

```sql theme={null}
SELECT
  dimension_value.email_sms AS message,
  COUNT(DISTINCT purchase_order_id) AS purchase_journeys,
  SUM(last_touch_revenue_impact.email_sms) AS last_touch_revenue
FROM `your_project.sm_experimental.obt_purchase_journeys_with_mta_models`
WHERE sm_store_id = 'your-sm_store_id'
  AND is_valid_touch.email_sms
  AND DATE(purchase_local_datetime) >= DATE_SUB(CURRENT_DATE(), INTERVAL 90 DAY)
GROUP BY 1
ORDER BY 2 DESC
LIMIT 20
```

## Brand campaigns

**Rule:** A campaign whose campaign tactic is Brand receives zero attributed revenue and zero attributed conversions in every model. Its spend, impressions, clicks, and platform-reported conversions are still reported in full.

A campaign is Brand when its campaign tactic is Brand. The tactic is derived from the campaign name: a name containing "brand", "branded", or "branding" is Brand, unless it also contains "non-brand".

Brand search captures demand that already exists. Crediting it would inflate its return and move budget away from the channels that create demand.

The same rule applies inside purchase journeys. A brand search visit is never a valid touch in the marketing channel dimension. In the ad, campaign, and ad group dimensions it receives no first-touch or linear credit, so that credit moves to the other touches in the journey.

Brand and non-brand spend side by side. The brand row always shows zero attributed revenue:

```sql theme={null}
SELECT
  IF(LOWER(ad_campaign_tactic) = 'brand', 'brand', 'non_brand') AS tactic_group,
  SUM(ad_spend) AS spend,
  SUM(ad_platform_reported_revenue) AS platform_reported_revenue,
  SUM(sm_last_touch_revenue) AS sm_last_touch_revenue
FROM `your_project.sm_experimental.rpt_ad_attribution_performance_daily`
WHERE sm_store_id = 'your-sm_store_id'
  AND date >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
GROUP BY 1
ORDER BY 1
```

## Channel-level rows

**Rule:** In `rpt_ad_attribution_performance_daily`, every row belongs to one `waterfall_level`: `ad_level`, `ad_group_level`, `campaign_level`, or `channel_level`. Spend lands at the most granular level the ad platform reported. A `channel_level` row holds spend, impressions, and clicks that the platform did not tie to any ad, ad group, or campaign. Those rows never carry attributed revenue, because there is no ad entity for a touch to match.

Two consequences:

* Spend and attributed revenue per platform add up without double counting. Totals per platform and day match `rpt_ad_performance_daily`.
* This table only credits ad entities. Credit for organic search, referrals, and other non-ad channels lives only in the marketing channel dimension of `obt_purchase_journeys_with_mta_models`.

Credit is also limited to rows whose `sm_channel` (the sales channel of the ad) is `Online DTC`.

Spend and linear revenue by ad platform and level. A high share of `channel_level` spend means the platform is not reporting ad-level detail:

```sql theme={null}
SELECT
  source_system AS ad_platform,
  waterfall_level,
  SUM(ad_spend) AS spend,
  SUM(sm_linear_revenue) AS sm_linear_revenue
FROM `your_project.sm_experimental.rpt_ad_attribution_performance_daily`
WHERE sm_store_id = 'your-sm_store_id'
  AND date >= DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
GROUP BY 1, 2
ORDER BY 1, 2
```
