AD/Marketing Tech

A DTC brand spends $2.4M/month across Google, Meta, TikTok, and email. The marketing team needs to know which touchpoint combination actually drives purchases — not the last-click attribution that gives 100% credit to the final ad.

Last-click attribution showed TikTok drove only 3% of revenue. When the team cut TikTok spend by 50%, Google and Meta conversions dropped 28% because TikTok was driving top-of-funnel awareness.
LIVEtouchpoints
user_idsession_idchannelcampaignactionrevenuets
usr_80012sess_t1atiktokspring_awarenessvideo_view02024-03-01T09:14:00.000Z
usr_80012sess_t1bgooglebrand_searchclick02024-03-05T11:22:00.000Z
usr_80012sess_t1cmetaretargeting_q1click02024-03-10T16:45:00.000Z
usr_80012sess_t1demailabandon_cart_flowclick189.992024-03-12T20:08:00.000Z
usr_73204sess_t2atiktokspring_awarenessvideo_view02024-03-02T14:30:00.000Z
usr_73204sess_t2btiktokcreator_collabclick02024-03-07T19:12:00.000Z
Streaming SQLRunning
Build per-user journey chains within 30-day conversion windows
CREATE SOURCE touchpoints WITH (
  connector = 'kafka',
  topic = 'marketing.touchpoints',
  properties.bootstrap.server = 'broker:9092'
) FORMAT PLAIN ENCODE JSON;

CREATE MATERIALIZED VIEW user_journeys AS
WITH conversions AS (
  SELECT
    user_id,
    ts AS conversion_ts,
    revenue
  FROM touchpoints
  WHERE revenue > 0
),
journeys AS (
  SELECT
    c.user_id,
    c.conversion_ts,
    c.revenue,
    t.channel,
    t.campaign,
    t.action,
    t.ts AS touch_ts,
    ROW_NUMBER() OVER (
      PARTITION BY c.user_id, c.conversion_ts
      ORDER BY t.ts
    ) AS touch_position,
    COUNT(*) OVER (
      PARTITION BY c.user_id, c.conversion_ts
    ) AS journey_length
  FROM conversions c
  JOIN touchpoints t
    ON c.user_id = t.user_id
    AND t.ts <= c.conversion_ts
    AND t.ts >= c.conversion_ts - INTERVAL '30 DAYS'
)
SELECT
  user_id,
  conversion_ts,
  revenue,
  channel,
  campaign,
  touch_position,
  journey_length,
  CASE
    WHEN journey_length = 1 THEN 1.0
    WHEN touch_position = 1 THEN 0.30
    WHEN touch_position = journey_length THEN 0.30
    ELSE 0.40 / (journey_length - 2)
  END AS position_weight
FROM journeys;
Compute channel contribution using position-weighted attribution
channel_attributionauto-updating
channellast_click_revenueattributed_revenueassist_countavg_positionroas
google892400684120142000.583.42
meta724800571440184000.652.86
tiktok72000456000312000.222.28
email71080068844086000.885.74
RisingWave computes Shapley-value attribution across all touchpoints in real time. TikTok's true contribution is 19% of revenue when measured by its assist value — the brand reverses the budget cut within 24 hours.
Best-in-Class Event Streaming
for Agents, Apps, and Analytics
GitHubXLinkedInSlackYouTube
Sign up for our to stay updated.