Shopify Ad Attribution
Cut through attribution lies — find out which channels actually drive profit, not just which ones take credit.
Paste your Shopify order UTM data and ad spend by channel. The agent calculates true ROAS, profit-adjusted ROAS, and surfaces channels that over- or under-claim credit.
Commands
CODEBLOCK0
What Data to Provide
The agent works with:
- - Shopify orders export — paste UTM source/medium/campaign columns from order export CSV
- Ad spend by channel — "Meta: $3,200 | Google: $1,800 | TikTok: $900 this month"
- COGS and margin — "product cost is 30% of revenue, Shopify fees ~3%"
- Channel setup — list of active ad channels and their primary UTM source values
- LTV data — if available: average repeat purchase rate and second-order value
No integrations needed. Paste exported data directly.
Workspace
Creates ~/shopify-attribution/ containing:
- -
setup.md — store configuration, COGS%, channel mapping, UTM conventions - INLINECODE2 — monthly attribution reports
- INLINECODE3 — historical ad spend by channel
- INLINECODE4 — flagged attribution anomalies
Analysis Framework
1. UTM Parameter Mapping
- - Map UTM source to channel: facebook/instagram → Meta, google/cpc → Google, tiktok → TikTok, email → Email, organic → Organic, (none)/(direct) → Direct
- Clean UTM data: normalize case, strip typos, consolidate variants (e.g., "FB" and "facebook" → Meta)
- Flag orders with missing UTM data — these are attribution dark zones (often direct/email/organic)
- Compute UTM coverage rate: % of orders with valid UTM source attribution
- Group by: source, medium, campaign for granular analysis
2. Last-Click Attribution Model
- - Assign 100% of order revenue to the last UTM source before purchase
- Compute per-channel: total revenue, order count, average order value
- Match against ad spend to get last-click ROAS: Revenue / Spend
- Flag: channels with very high last-click ROAS — may be capturing credit from upper-funnel channels
- Flag: direct/(none) volume — if >30% of revenue is unattributed, attribution picture is incomplete
3. Linear Attribution Model
- - Distribute revenue equally across all touchpoints in a customer journey
- Requires multi-session UTM data — if not available, estimate using channel mix ratios
- Compare linear attribution revenue vs. last-click revenue per channel
- Channels that gain credit under linear: typically top-of-funnel (Meta, TikTok, YouTube)
- Channels that lose credit under linear: typically bottom-of-funnel (Google Brand, Email)
4. Time-Decay Attribution Model
- - Weight touchpoints more heavily the closer they are to the purchase
- Decay formula: weight = e^(−λ × daysbeforepurchase), λ = 0.1 for 7-day half-life
- Useful for longer purchase cycles (furniture, high-ticket items)
- Compare time-decay vs. last-click — large differences indicate assisted conversion patterns
5. ROAS Calculation
- - Reported ROAS = Total Revenue Attributed / Ad Spend
- Gross Profit ROAS = (Revenue × Gross Margin%) / Ad Spend
- Net Profit ROAS = (Revenue × Net Margin% after fees) / Ad Spend
- Profitability threshold: Net Profit ROAS must exceed 1.0 to be contribution-positive
- True break-even ROAS = 1 / (Gross Margin% − Platform Fee%)
- Example: 60% margin, 3% Shopify fee → Break-even ROAS = 1 / 0.57 = 1.75
6. Channel Overlap and LTV Adjustment
- - Identify customers who converted via multiple channels in a 30-day window
- Flag: Meta + Google overlap — common pattern where Meta drives discovery, Google captures conversion
- LTV adjustment: multiply first-order ROAS by repeat purchase multiplier
- If avg customer makes 1.4 purchases in first year, LTV ROAS = Reported ROAS × 1.4
- - Cohort LTV by acquisition channel — some channels acquire better long-term customers
7. Attribution Anomaly Detection
- - Flag: channel spend increased but attributed revenue flat → ad performance degrading or UTM broken
- Flag: direct/(none) revenue spike without organic traffic explanation → UTM tags broken in campaign
- Flag: single campaign taking disproportionate credit (>40% of revenue) → potential tracking issue
- Flag: ROAS dramatically higher than industry benchmark → verify UTM data quality
Output Format
INLINECODE5 delivers:
Channel Summary Table
| Channel | Spend | Revenue (LC) | ROAS (LC) | Profit ROAS | Orders |
|---|
| Meta | $X | $X | X.Xx | X.Xx | N |
| Google |
... | ... | ... | ... | ... |
Attribution Model Comparison
| Channel | Last-Click | Linear | Time-Decay | Difference |
|---------|-----------|--------|------------|------------|
Key Findings
- 1. Best true-ROAS channel (profit-adjusted)
- Most over-credited channel (last-click vs. linear gap)
- Attribution coverage rate and dark zone estimate
- Recommended budget reallocation
Rules
- 1. Always establish COGS and margin before computing profit-adjusted ROAS — reported ROAS without margin context is misleading
- Never declare a channel unprofitable based on last-click attribution alone — always show multi-touch comparison
- Flag UTM coverage rate prominently — if >25% of orders lack UTM data, all channel numbers are understated
- Apply the correct break-even ROAS threshold for the store's margin — not a generic benchmark
- Distinguish between revenue attribution and profit attribution — high-AOV channels may look great on revenue but poor on profit
- Identify the Meta vs. Google credit-stealing dynamic by default — it is the most common misattribution pattern in Shopify stores
- Save reports to
~/shopify-attribution/reports/ with month-year filename on every attribution save call
Shopify 广告归因
穿透归因谎言——找出哪些渠道真正驱动利润,而不仅仅是哪些渠道获得功劳。
粘贴您的 Shopify 订单 UTM 数据和按渠道划分的广告支出。该智能体计算真实 ROAS、利润调整后 ROAS,并揭示过度或不足认领功劳的渠道。
命令
attribution setup # 配置店铺、销货成本率、渠道和支出数据
attribution report # 全渠道完整归因分析
attribution by channel # 按渠道划分的收入、支出和 ROAS 明细
attribution roas # 按渠道划分的 ROAS 和利润调整后 ROAS
attribution ltv # LTV 调整后归因(重复购买价值)
attribution last click vs multi touch # 比较最后点击与线性模型与时间衰减模型
attribution anomaly # 标记具有异常功劳分配模式的渠道
attribution save # 将设置和最新报告保存到工作区
需要提供的数据
该智能体处理以下数据:
- - Shopify 订单导出 — 从订单导出 CSV 粘贴 UTM 来源/媒介/活动列
- 按渠道划分的广告支出 — 本月 Meta:3,200 美元 | Google:1,800 美元 | TikTok:900 美元
- 销货成本和利润率 — 产品成本占收入的 30%,Shopify 费用约 3%
- 渠道设置 — 活跃广告渠道列表及其主要 UTM 来源值
- LTV 数据 — 如可用:平均重复购买率和二次订单价值
无需集成。直接粘贴导出的数据。
工作区
创建 ~/shopify-attribution/ 目录,包含:
- - setup.md — 店铺配置、销货成本率、渠道映射、UTM 约定
- reports/ — 月度归因报告
- spend-log.md — 按渠道划分的历史广告支出
- anomalies.md — 标记的归因异常
分析框架
1. UTM 参数映射
- - 将 UTM 来源映射到渠道:facebook/instagram → Meta,google/cpc → Google,tiktok → TikTok,email → 邮件,organic → 自然流量,(none)/(direct) → 直接流量
- 清理 UTM 数据:规范化大小写,去除拼写错误,合并变体(例如,FB和facebook → Meta)
- 标记缺少 UTM 数据的订单——这些是归因盲区(通常是直接/邮件/自然流量)
- 计算 UTM 覆盖率:具有有效 UTM 来源归因的订单百分比
- 按来源、媒介、活动分组进行细粒度分析
2. 最后点击归因模型
- - 将 100% 的订单收入分配给购买前的最后一个 UTM 来源
- 计算每个渠道:总收入、订单数、平均订单价值
- 与广告支出匹配,得出最后点击 ROAS:收入 / 支出
- 标记:最后点击 ROAS 极高的渠道——可能从漏斗顶部渠道获取功劳
- 标记:直接/(无)流量——如果超过 30% 的收入无法归因,则归因画像不完整
3. 线性归因模型
- - 将收入平均分配给客户旅程中的所有接触点
- 需要多会话 UTM 数据——如不可用,则使用渠道组合比例进行估算
- 比较每个渠道的线性归因收入与最后点击归因收入
- 在线性模型下获得功劳的渠道:通常是漏斗顶部(Meta、TikTok、YouTube)
- 在线性模型下失去功劳的渠道:通常是漏斗底部(Google 品牌词、邮件)
4. 时间衰减归因模型
- - 越接近购买时间的接触点权重越高
- 衰减公式:权重 = e^(−λ × 购买前天数),λ = 0.1(7 天半衰期)
- 适用于较长购买周期(家具、高客单价商品)
- 比较时间衰减与最后点击——差异大表明存在辅助转化模式
5. ROAS 计算
- - 报告 ROAS = 归因总收入 / 广告支出
- 毛利润 ROAS = (收入 × 毛利率%) / 广告支出
- 净利润 ROAS = (收入 × 扣除费用后净利率%) / 广告支出
- 盈利阈值:净利润 ROAS 必须超过 1.0 才能贡献正利润
- 真实盈亏平衡 ROAS = 1 / (毛利率% − 平台费用%)
- 示例:60% 毛利率,3% Shopify 费用 → 盈亏平衡 ROAS = 1 / 0.57 = 1.75
6. 渠道重叠与 LTV 调整
- - 识别在 30 天窗口内通过多个渠道转化的客户
- 标记:Meta + Google 重叠——常见模式是 Meta 驱动发现,Google 捕获转化
- LTV 调整:将首单 ROAS 乘以重复购买乘数
- 如果平均客户在第一年购买 1.4 次,则 LTV ROAS = 报告 ROAS × 1.4
- - 按获客渠道划分的群组 LTV——某些渠道能获取更好的长期客户
7. 归因异常检测
- - 标记:渠道支出增加但归因收入持平 → 广告效果下降或 UTM 损坏
- 标记:直接/(无)收入激增但无自然流量解释 → 活动中的 UTM 标签损坏
- 标记:单个活动获得不成比例的功劳(>40% 的收入)→ 可能存在跟踪问题
- 标记:ROAS 远高于行业基准 → 验证 UTM 数据质量
输出格式
attribution report 输出:
渠道汇总表
| 渠道 | 支出 | 收入(最后点击) | ROAS(最后点击) | 利润 ROAS | 订单数 |
|---|
| Meta | $X | $X | X.X倍 | X.X倍 | N |
| Google |
... | ... | ... | ... | ... |
归因模型对比
| 渠道 | 最后点击 | 线性 | 时间衰减 | 差异 |
|---------|-----------|--------|------------|------------|
关键发现
- 1. 最佳真实 ROAS 渠道(利润调整后)
- 最被过度认领功劳的渠道(最后点击与线性差距)
- 归因覆盖率和盲区估算
- 建议的预算重新分配
规则
- 1. 在计算利润调整后 ROAS 之前,始终先确定销货成本和利润率——没有利润率背景的报告 ROAS 具有误导性
- 切勿仅基于最后点击归因就宣布某个渠道不盈利——始终展示多渠道对比
- 显著标记 UTM 覆盖率——如果超过 25% 的订单缺少 UTM 数据,所有渠道数据都会被低估
- 根据店铺利润率应用正确的盈亏平衡 ROAS 阈值——而非通用基准
- 区分收入归因和利润归因——高客单价渠道在收入上可能表现良好,但在利润上表现不佳
- 默认识别 Meta 与 Google 之间的功劳窃取动态——这是 Shopify 店铺中最常见的错误归因模式
- 每次调用 attribution save 时,将报告保存到 ~/shopify-attribution/reports/,文件名包含月份-年份