01Jobs it does
Each one is a real command line. Copy it, or open it in the builder below to change it.
multi touch attribution
Also: attribution report
p202 attribution breakdown02What you get
Captured from the real binary, run against a demo store with 30 days of traffic. Switch tabs to see the same run as JSON, the shape scripts and agents parse.
$ p202 attribution breakdown --group-by traffic_source --period last30 name ROI % assisted_conversions attributed_conversions attributed_revenue clicks cost key ------------------------ ------- -------------------- ---------------------- ------------------ ------ --------- --- Search Ads - Shopping 1068.54 1 26 5776 663 494.29 2 Newsletter 1 15 3540 238 0 5 Social Ads - Prospecting 427.48 1 31 2956 970 560.4 3 Search Ads - Brand 167.69 0 30 1927 523 719.86 1 Podcast Sponsorship 515.03 4 6 1064 220 173 6 Social Ads - Retargeting 571.90 0 13 574 287 85.43 4
$ p202 attribution breakdown --group-by traffic_source --period last30 --json { "data": [ { "assisted_conversions": 1, "attributed_conversions": "26.00000000", "attributed_revenue": "5776.00000", "clicks": 663, "cost": "494.29000", "key": "2", "name": "Search Ads - Shopping", "roi": 1068.54 }, { "assisted_conversions": 1, "attributed_conversions": "15.00000000", "attributed_revenue": "3540.00000", "clicks": 238, "cost": "0.00000", "key": "5", "name": "Newsletter", "roi": null }, { "assisted_conversions": 1, "attributed_conversions": "31.00000000", "attributed_revenue": "2956.00000", "clicks": 970, "cost": "560.40000", "key": "3", "name": "Social Ads - Prospecting", "roi": 427.48 }, { "assisted_conversions": 0, "attributed_conversions": "30.00000000", "attributed_revenue": "1927.00000", "clicks": 523, "cost": "719.86000", "key": "1", "name": "Search Ads - Brand", "roi": 167.69 }, { "assisted_conversions": 4, "attributed_conversions": "6.00000000", "attributed_revenue": "1064.00000", "clicks": 220, "cost": "173.00000", "key": "6", "name": "Podcast Sponsorship", "roi": 515.03 }, { "assisted_conversions": 0, "attributed_conversions": "13.00000000", "attributed_revenue": "574.00000", "clicks": 287, "cost": "85.43000", "key": "4", "name": "Social Ads - Retargeting", "roi": 571.9 } ], "meta": { "backfill": null, "cohort": "conversion", "compare_model": null, "group_by": "traffic_source", "groups": 6, "limit": 100, "model": { "default_model_id": 1, "description": "Each conversion under its campaign's model override when that model is active, otherwise the account default.", "mode": "effective" }, "offset": 0, "time_from": 1788926400, "time_to": 1791540195, "timezone": "America/New_York" }, "totals": { "attributed_conversions": "121.00000000", "attributed_revenue": "15837.00000", "conversions": 121 } }
Attributed revenue by traffic source
Drawn from the JSON output above.
$ p202 attribution breakdown --group-by traffic_source --period last30 --compare-model 2 name ROI % assisted_conversions attributed_conversions attributed_revenue clicks compare_attributed_conversions compare_attributed_revenue compare_roi cost key ------------------------ ------- -------------------- ---------------------- ------------------ ------ ------------------------------ -------------------------- ----------- --------- --- Search Ads - Shopping 1068.54 1 26 5776 663 27 5984 1110.63 494.29 2 Newsletter 1 15 3540 238 16 3558 0 5 Social Ads - Prospecting 427.48 1 31 2956 970 30 2759 392.33 560.4 3 Search Ads - Brand 167.69 0 30 1927 523 25 1770 145.88 719.86 1 Podcast Sponsorship 515.03 4 6 1064 220 10 1192 589.02 173 6 Social Ads - Retargeting 571.90 0 13 574 287 13 574 571.90 85.43 4
$ p202 attribution breakdown --group-by traffic_source --period last30 --compare-model 2 --json { "data": [ { "assisted_conversions": 1, "attributed_conversions": "26.00000000", "attributed_revenue": "5776.00000", "clicks": 663, "compare_attributed_conversions": "27.00000000", "compare_attributed_revenue": "5984.00000", "compare_roi": 1110.63, "cost": "494.29000", "key": "2", "name": "Search Ads - Shopping", "roi": 1068.54 }, { "assisted_conversions": 1, "attributed_conversions": "15.00000000", "attributed_revenue": "3540.00000", "clicks": 238, "compare_attributed_conversions": "16.00000000", "compare_attributed_revenue": "3558.00000", "compare_roi": null, "cost": "0.00000", "key": "5", "name": "Newsletter", "roi": null }, { "assisted_conversions": 1, "attributed_conversions": "31.00000000", "attributed_revenue": "2956.00000", "clicks": 970, "compare_attributed_conversions": "30.00000000", "compare_attributed_revenue": "2759.00000", "compare_roi": 392.33, "cost": "560.40000", "key": "3", "name": "Social Ads - Prospecting", "roi": 427.48 }, { "assisted_conversions": 0, "attributed_conversions": "30.00000000", "attributed_revenue": "1927.00000", "clicks": 523, "compare_attributed_conversions": "25.00000000", "compare_attributed_revenue": "1770.00000", "compare_roi": 145.88, "cost": "719.86000", "key": "1", "name": "Search Ads - Brand", "roi": 167.69 }, { "assisted_conversions": 4, "attributed_conversions": "6.00000000", "attributed_revenue": "1064.00000", "clicks": 220, "compare_attributed_conversions": "10.00000000", "compare_attributed_revenue": "1192.00000", "compare_roi": 589.02, "cost": "173.00000", "key": "6", "name": "Podcast Sponsorship", "roi": 515.03 }, { "assisted_conversions": 0, "attributed_conversions": "13.00000000", "attributed_revenue": "574.00000", "clicks": 287, "compare_attributed_conversions": "13.00000000", "compare_attributed_revenue": "574.00000", "compare_roi": 571.9, "cost": "85.43000", "key": "4", "name": "Social Ads - Retargeting", "roi": 571.9 } ], "meta": { "backfill": null, "cohort": "conversion", "compare_model": { "created_at": 1791539625, "is_default": false, "lookback_days": 30, "model_id": 2, "model_name": "First touch", "model_slug": "first-touch", "model_type": "first_touch", "recompute_pending": false, "status": "active", "status_reason": null, "updated_at": 1791539625, "weighting_config": {} }, "group_by": "traffic_source", "groups": 6, "limit": 100, "model": { "default_model_id": 1, "description": "Each conversion under its campaign's model override when that model is active, otherwise the account default.", "mode": "effective" }, "offset": 0, "time_from": 1788926400, "time_to": 1791540195, "timezone": "America/New_York" }, "totals": { "attributed_conversions": "121.00000000", "attributed_revenue": "15837.00000", "compare_attributed_conversions": "121.00000000", "compare_attributed_revenue": "15837.00000", "conversions": 121 } }
$ p202 attribution breakdown --group-by campaign --period last30 name ROI % assisted_conversions attributed_conversions attributed_revenue clicks cost key ---------------------------- ------- -------------------- ---------------------- ------------------ ------ --------- --- Project Tool Pro Annual / US 789.42 0 10 4440 308 499.2 4 Standing Desk Launch / UK 736.91 0 8 3551 438 424.3 3 Spring Collection / US 847.68 1 24 3378 787 356.45 1 Holiday Gift Cards / AU 1112.98 0 13 1450 288 119.54 7 Bakery Pre-orders / Local 5011.11 1 18 1380 238 27 6 Coffee Subscription / US 420.06 4 30 1116 544 214.59 2 Free Trial to Paid / CA 33.20 1 18 522 298 391.9 5
$ p202 attribution breakdown --group-by campaign --period last30 --json { "data": [ { "assisted_conversions": 0, "attributed_conversions": "10.00000000", "attributed_revenue": "4440.00000", "clicks": 308, "cost": "499.20000", "key": "4", "name": "Project Tool Pro Annual / US", "roi": 789.42 }, { "assisted_conversions": 0, "attributed_conversions": "8.00000000", "attributed_revenue": "3551.00000", "clicks": 438, "cost": "424.30000", "key": "3", "name": "Standing Desk Launch / UK", "roi": 736.91 }, { "assisted_conversions": 1, "attributed_conversions": "24.00000000", "attributed_revenue": "3378.00000", "clicks": 787, "cost": "356.45000", "key": "1", "name": "Spring Collection / US", "roi": 847.68 }, { "assisted_conversions": 0, "attributed_conversions": "13.00000000", "attributed_revenue": "1450.00000", "clicks": 288, "cost": "119.54000", "key": "7", "name": "Holiday Gift Cards / AU", "roi": 1112.98 }, { "assisted_conversions": 1, "attributed_conversions": "18.00000000", "attributed_revenue": "1380.00000", "clicks": 238, "cost": "27.00000", "key": "6", "name": "Bakery Pre-orders / Local", "roi": 5011.11 }, { "assisted_conversions": 4, "attributed_conversions": "30.00000000", "attributed_revenue": "1116.00000", "clicks": 544, "cost": "214.59000", "key": "2", "name": "Coffee Subscription / US", "roi": 420.06 }, { "assisted_conversions": 1, "attributed_conversions": "18.00000000", "attributed_revenue": "522.00000", "clicks": 298, "cost": "391.90000", "key": "5", "name": "Free Trial to Paid / CA", "roi": 33.2 } ], "meta": { "backfill": null, "cohort": "conversion", "compare_model": null, "group_by": "campaign", "groups": 7, "limit": 100, "model": { "default_model_id": 1, "description": "Each conversion under its campaign's model override when that model is active, otherwise the account default.", "mode": "effective" }, "offset": 0, "time_from": 1788926400, "time_to": 1791540195, "timezone": "America/New_York" }, "totals": { "attributed_conversions": "121.00000000", "attributed_revenue": "15837.00000", "conversions": 121 } }
03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 attribution breakdownSet flags below; the command updates as you type.
04Flags
10 flags, plus the global flags every command takes.
| Flag | What it does |
|---|---|
| --cohortstring | conversion: the sales made in the range (default); click: what the range's clicks earned, as the classic reports count. Values: conversion, clickconversionclick |
| --compare-modelstring | A second model id, side by side |
| --group-bystring · default campaign | Dimension: campaign, traffic_source, landing_page, keyword, c1, c2, c3, c4, country, device, daycampaigntraffic_sourcelanding_pagekeywordc1c2c3c4countrydeviceday |
| --keysstring | Only these rows: up to 1000 row keys (data[].key), comma-separated |
| --limitstring | Rows, 1-1000 (default 100) |
| --modelstring | Model id (default: each campaign's override, else the account default) |
| --offsetstring | Rows to skip, for paging past --limit (meta.groups is the total; needs a server with attribution paging) |
| --periodstring | Range (default: the last 30 days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltimetodayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime |
| --time-fromstring | Range start, unix seconds |
| --time-tostring | Range end, unix seconds |
05How it works
Attributed conversions (sum of credit) and revenue for conversions in the range, grouped by a dimension of the credited clicks; clicks and cost from the dimension's own clicks; and assisted conversions (journeys where the dimension had a touch before the converting click).
Without --model the report is "effective": each conversion under its campaign's model override when that model is active, otherwise the account default.
--cohort click reads credits and assists by the date of the click they land on instead of the sale's date: each row is what its own clicks in the range earned (whenever they converted) against their cost, the population the classic reports count.
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands attribution breakdown --json. - With
AI_AGENT,CLAUDECODEor another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with ahint. - Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
{
"path": "p202 attribution breakdown",
"use": "breakdown",
"short": "Attributed conversions, revenue, cost and ROI by a click dimension; --compare-model puts two models side by side",
"long": "Attributed conversions (sum of credit) and revenue for conversions in the range, grouped by a\ndimension of the credited clicks; clicks and cost from the dimension's own clicks; and assisted\nconversions (journeys where the dimension had a touch before the converting click).\n\nWithout --model the report is \"effective\": each conversion under its campaign's model override\nwhen that model is active, otherwise the account default.\n\n--cohort click reads credits and assists by the date of the click they land on instead of the\nsale's date: each row is what its own clicks in the range earned (whenever they converted) against\ntheir cost, the population the classic reports count.",
"runnable": true,
"tasks": [
{
"run": "p202 attribution breakdown",
"ui_pages": [
"Attribution"
],
"phrases": [
"multi touch attribution",
"attribution report"
]
}
],
"flags": [
{
"name": "cohort",
"type": "string",
"default": "",
"usage": "conversion: the sales made in the range (default); click: what the range's clicks earned, as the classic reports count. Values: conversion, click",
"allowed_values": [
"conversion",
"click"
],
"required": false
},
{
"name": "compare-model",
"type": "string",
"default": "",
"usage": "A second model id, side by side",
"required": false
},
{
"name": "group-by",
"type": "string",
"default": "campaign",
"usage": "Dimension: campaign, traffic_source, landing_page, keyword, c1, c2, c3, c4, country, device, day",
"allowed_values": [
"campaign",
"traffic_source",
"landing_page",
"keyword",
"c1",
"c2",
"c3",
"c4",
"country",
"device",
"day"
],
"required": false
},
{
"name": "keys",
"type": "string",
"default": "",
"usage": "Only these rows: up to 1000 row keys (data[].key), comma-separated",
"required": false
},
{
"name": "limit",
"type": "string",
"default": "",
"usage": "Rows, 1-1000 (default 100)",
"required": false
},
{
"name": "model",
"type": "string",
"default": "",
"usage": "Model id (default: each campaign's override, else the account default)",
"required": false
},
{
"name": "offset",
"type": "string",
"default": "",
"usage": "Rows to skip, for paging past --limit (meta.groups is the total; needs a server with attribution paging)",
"required": false
},
{
"name": "period",
"type": "string",
"default": "",
"usage": "Range (default: the last 30 days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime",
"allowed_values": [
"today",
"yesterday",
"last7",
"last14",
"last30",
"last90",
"thismonth",
"lastmonth",
"thisyear",
"lastyear",
"alltime"
],
"required": false
},
{
"name": "time-from",
"type": "string",
"default": "",
"usage": "Range start, unix seconds",
"required": false
},
{
"name": "time-to",
"type": "string",
"default": "",
"usage": "Range end, unix seconds",
"required": false
}
]
}