Prove which campaigns drive revenue with multi-touch attribution in Snowflake

Accelerator Marketing Architect

Last-click reports hand all the credit to the final ad and none to the campaign that brought the customer in. Build five attribution models in Snowflake from your Fullstory data, so you can back the promotions that earn revenue and cut the ones that don't.

The business outcome

Most customers visit more than once before they buy. They click a paid ad, come back from an email, then return directly to check out. A last-click report credits that sale to "direct" and tells you the ad and the email did nothing. So you cut the campaign that started the sale and pour budget into the one that happened to be last.

This accelerator turns your Fullstory session data into an attribution table in Snowflake. Every conversion gets split across the sessions that led to it, under five models side by side. You see which campaigns open the door, which close the sale, and which do neither.

Measure it by comparing revenue per campaign across models. A campaign that ranks high on First Touch but low on Last Touch is starting sales and losing credit for them. A campaign that's low on every model is a candidate to cut.

How it works

Fullstory syncs your data to Snowflake

Every session, page view and custom event lands in your warehouse.

Each session gets one channel

Click IDs, UTM tags and referrers decide its source, medium and campaign.

Sessions get linked to purchases

Any session in the 14 days before a conversion is part of that conversion's path.

Revenue gets split five ways

First Touch, Last Touch, Linear, 40-20-40 U-Shaped and Full Credit, all in one table that refreshes hourly.

How attribution splits the credit

Picture one customer who visits four times in the two weeks before a $120 purchase: from a paid ad and an email (both from the spring_sale campaign), then from a Google search, then directly to check out. Each model answers a different question about who earned that sale:

Visit →
Paid ad
Email
Search
Direct
First Touch
Starts the sale
$120
$0
$0
$0
Last Touch
Closes the sale
$0
$0
$0
$120
Linear
Equal split
$30
$30
$30
$30
40-20-40 U-Shaped
Ends weigh most
$48
$12
$12
$48
Full Credit
Every channel, full value
$120
$120
$120
$120

Each bar shows how much of the $120 order that session earns.

Last Touch alone gives the spring_sale campaign nothing, even though it brought the customer in twice. Seeing all five models side by side is what shows you that.

Before you start

  • Fullstory Anywhere: Warehouse is an add-on that requires a specific plan. Talk to your Fullstory account team to add it.
  • Sync your data with Fullstory Anywhere: Warehouse. Follow Warehouse - Getting Started to connect Snowflake. You need an Admin or Architect role in Fullstory to configure it.
  • Get a Snowflake role that can create a database, such as SYSADMIN, and a virtual warehouse to run refreshes. An XS warehouse is enough to start.
  • Install the Snowflake CLI and make.
  • Send a Revenue Event when someone buys, with the order value as an event property. This is your conversion.

Tell the pipeline what counts as a conversion

Attribution needs to know which event is a purchase and where its revenue lives. Set this before you deploy, since the first deploy step creates the config table from these values.

  1. Clone the fullstory-anywhere-warehouse repo and open the snowflake/multi_touch_attribution folder.
  2. Open 00_setup/01_config_and_schema.sql. In the INSERT, set conversion_event_name to your custom event's name, exactly as you send it to Fullstory. The default is Checkout Success.
  3. In the same INSERT, set attribution_window_days (default 14) to how many days before a purchase a session can earn credit. Set lookback_days (default 90) to how much history to load.
  4. Open 01_staging/stg_fs__custom_events.sql. Change event_properties:price to the property that holds your order value.

You can change these later without redeploying. Update the row in fs_marketing.config.attribution_config, then run make refresh.

Deploy the pipeline

The pipeline builds three layers in a new fs_marketing database: staging views over your raw Fullstory tables, then dynamic tables for touchpoints and conversions, then the attribution table. Snowflake keeps them up to date on its own after this.

  1. Copy .env.example to .env. Fill in your Snowflake connection name, role and warehouse.
  2. Add your four Fullstory table names to .env. They end in _EVENTS, _SOURCE_PROPERTIES, _USERS and _CUSTOM_EVENTS.
  3. Add a connection profile to ~/.snowflake/config.toml with a programmatic access token. Run make check-conn to confirm it works.
  4. Run make phase1 to create the database, config table and staging views.
  5. Run make phase2 to create the touchpoint and conversion dynamic tables.
  6. Run make phase3 to create fs_marketing.marts.fct_marketing_attribution. It refreshes hourly to match your warehouse sync.
  7. Run make status to check that all three dynamic tables are refreshing.

How each session gets its channel

A session can carry more than one signal, like a UTM tag and a Google referrer. The pipeline checks for signals in a fixed order and keeps the first one it finds, so the same session always gets the same channel:

Checked in this order. First match wins.Medium
1
Paid click ID
gclid or fbclid in the URL
cpc
2
UTM tags
utm_medium in the URL
your utm_medium
3
Search referrer
Came from Google or Bing
organic
4
Other referrer
Came from any other site
referral
5
No signal
Typed the URL or used a bookmark
direct

Campaign comes from utm_campaign, then cmpid. Sessions with neither are labeled organic/untracked.

Compare your campaigns across models

Run this query to see revenue by campaign under every model for the last 30 days:

SELECT
 campaign,
 ROUND(SUM(IFF(attribution_model = 'First Touch', attributed_revenue, 0)), 2) AS first_touch,
 ROUND(SUM(IFF(attribution_model = 'Last Touch', attributed_revenue, 0)), 2) AS last_touch,
 ROUND(SUM(IFF(attribution_model = 'Linear', attributed_revenue, 0)), 2) AS linear,
 ROUND(SUM(IFF(attribution_model = '40-20-40 U-Shaped', attributed_revenue, 0)), 2) AS u_shaped,
 ROUND(SUM(IFF(attribution_model = 'Full Credit', attributed_revenue, 0)), 2) AS full_credit
FROM fs_marketing.marts.fct_marketing_attribution
WHERE converted_at >= DATEADD(day, -30, CURRENT_TIMESTAMP)
GROUP BY campaign
ORDER BY linear DESC;

Swap campaign for source or medium to compare at the channel level.

Here's what that query returned on Fullstory's demo data, a car rental site, for its top campaigns over 30 days:

Campaign First Touch Last Touch Linear U-Shaped Full Credit
vip_launch_2025 $1,198,679 $1,507,997 $1,341,551 $1,347,418 $1,617,057
summer_sale_2024 $903,923 $1,013,194 $945,904 $952,460 $1,260,613
cargo_rental_2025 $874,793 $997,393 $915,742 $927,536 $1,472,306
content_2025 $344,884 $348,521 $344,743 $345,281 $578,237
display_2025 $291,816 $284,598 $277,217 $283,931 $554,390
holiday_promo_2025 $114,135 $99,893 $102,367 $105,157 $164,311

The rows tell different stories. vip_launch_2025 earns $309,000 more on Last Touch than First Touch, so it's closing sales other channels started. holiday_promo_2025 and display_2025 go the other way: they bring people in and lose credit by the time they buy. A last-click report would undersell both.

First Touch, Last Touch, Linear and U-Shaped each add up to your total revenue. Full Credit counts the same order once per channel, so its column adds up to more than you earned. Use it to compare channels, not to report totals.

What's next

You now have revenue credit for every campaign under five models, refreshed hourly. Here's where to take it.

Explore it in a dashboard. The repo includes a Streamlit in Snowflake app on top of the attribution table. Run make dashboard to deploy it, then pick a date range and model to see conversions, revenue by channel, the most common paths to purchase, and a link to the session replay behind every conversion.

Marketing Attribution dashboard showing conversions, attributed revenue, average path length, days to convert and daily attributed revenue

The Paths tab shows how customers move between channels on the way to a purchase:

Channel flow chart showing customer paths across five steps to conversion

Ask why a campaign is slipping. Attribution tells you a campaign's revenue dropped. It doesn't tell you why. The Cortex starter kit puts a Snowflake Cortex Agent over your Fullstory data, so you can ask in plain language whether people from that campaign hit errors, rage clicks or form abandons. Add the Fullstory MCP server to pull up the sessions behind the answer.

Put a price on each model. Join fct_marketing_attribution to your ad spend by campaign to get return on ad spend under every model. A campaign that loses money no matter how you count it is the easiest cut you'll make.


Was this article helpful?

Got Questions?

Get in touch with a Fullstory rep, ask the community or check out our developer documentation.