p202 attribution breakdown

Attributed conversions, revenue, cost and ROI by a click dimension; --compare-model puts two models side by side

Web UIAttribution
All commands

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 breakdown
Web UIAttribution

02What 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
$ 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
Real output · p202 1.9.77 · demo dataexit 0

Attributed revenue by traffic source

  • Search Ads - Shopping$5,776.00
  • Newsletter$3,540.00
  • Social Ads - Prospecting$2,956.00
  • Search Ads - Brand$1,927.00
  • Podcast Sponsorship$1,064.00
  • Social Ads - Retargeting$574.00

Drawn from the JSON output above.

p202 attribution breakdown --group-by traffic_source --period last30 --compare-model 2
$ 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
Real output · p202 1.9.77 · demo dataexit 0
p202 attribution breakdown --group-by campaign --period last30
$ 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
Real output · p202 1.9.77 · demo dataexit 0

03Build your command

Pick values and the command line writes itself, quoted and ready to paste.

p202 attribution breakdown

Set flags below; the command updates as you type.

04Flags

10 flags, plus the global flags every command takes.

FlagWhat it does
--cohortstringconversion: the sales made in the range (default); click: what the range's clicks earned, as the classic reports count. Values: conversion, click
conversionclick
--compare-modelstringA second model id, side by side
--group-bystring · default campaignDimension: campaign, traffic_source, landing_page, keyword, c1, c2, c3, c4, country, device, day
campaigntraffic_sourcelanding_pagekeywordc1c2c3c4countrydeviceday
--keysstringOnly these rows: up to 1000 row keys (data[].key), comma-separated
--limitstringRows, 1-1000 (default 100)
--modelstringModel id (default: each campaign's override, else the account default)
--offsetstringRows to skip, for paging past --limit (meta.groups is the total; needs a server with attribution paging)
--periodstringRange (default: the last 30 days): today, yesterday, last7, last14, last30, last90, thismonth, lastmonth, thisyear, lastyear, alltime
todayyesterdaylast7last14last30last90thismonthlastmonththisyearlastyearalltime
--time-fromstringRange start, unix seconds
--time-tostringRange 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, CLAUDECODE or another agent variable set, output is compact JSON and errors arrive on stderr as a JSON envelope with a hint.
  • Exit codes: 0 ok, 1 bad input, 2 auth, 3 network, 4 server error, 5 partial failure.
p202 commands attribution breakdown --json
{
  "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
    }
  ]
}