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 - Brand        469.67   2                     31                      4103                524     720.24     1
Search Ads - Shopping     720.17   0                     21                      4054                663     494.29     2
Social Ads - Prospecting  370.53   2                     27                      2636                969     560.22     3
Newsletter                         1                     22                      2477                238     0          5
Podcast Sponsorship       540.46   1                     5                       1108                220     173        6
Social Ads - Retargeting  1040.74  2                     14                      971                 286     85.12      4
Real output · p202 1.9.78 · demo dataexit 0

Attributed revenue by traffic source

  • Search Ads - Brand$4,103.00
  • Search Ads - Shopping$4,054.00
  • Social Ads - Prospecting$2,636.00
  • Newsletter$2,477.00
  • Podcast Sponsorship$1,108.00
  • Social Ads - Retargeting$971.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 - Brand        469.67   2                     31                      4103                524     31                              4103                        469.67       720.24     1
Search Ads - Shopping     720.17   0                     21                      4054                663     20                              3954                        699.94       494.29     2
Social Ads - Prospecting  370.53   2                     27                      2636                969     28                              2654                        373.74       560.22     3
Newsletter                         1                     22                      2477                238     21                              2345                                     0          5
Podcast Sponsorship       540.46   1                     5                       1108                220     5                               1108                        540.46       173        6
Social Ads - Retargeting  1040.74  2                     14                      971                 286     15                              1185                        1292.15      85.12      4
Real output · p202 1.9.78 · 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  950.48   2                     13                      5244                308     499.2      4
Spring Collection / US        890.88   1                     25                      3532                787     356.45     1
Standing Desk Launch / UK     349.45   0                     5                       1907                438     424.3      3
Holiday Gift Cards / AU       1283.88  1                     13                      1650                287     119.23     7
Bakery Pre-orders / Local     5839.60  1                     23                      1593                237     26.82      6
Coffee Subscription / US      359.60   1                     26                      988                 545     214.97     2
Free Trial to Paid / CA       11       2                     15                      435                 298     391.9      5
Real output · p202 1.9.78 · 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, 6 no Pro licence on the install.
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
    }
  ]
}