01Run it
Replace the <placeholders> with your own values, or use the builder below.
p202 goal create02What you get
Pick the shape you need. People get a table. Add
--json, --csv or --ndjson for scripts, or -q for ids only. An AI agent gets compact JSON without asking. All output formats03Build your command
Pick values and the command line writes itself, quoted and ready to paste.
p202 goal createSet flags below; the command updates as you type.
04Flags
25 flags, plus the global flags every command takes.
| Flag | What it does |
|---|---|
| --accountbool | Owner: the account (shared by every app) |
| --afterstring | Goal ids that must be reached first, comma-separated |
| --campaign-idstring | Owner: this campaign (p202 campaign list) |
| --countstring | Reached on the Nth matching event (default 1) |
| --definitionstring | The whole definition as JSON (exclusive with the quick flags) |
| --eventstring | Trigger: the event name that reaches the goal |
| --file, -Fstring | Read the definition JSON from a file (- for stdin) |
| --idempotency-keystring | Retry-safe create: the server records the response under this key and replays it on a retry with the same key and payload instead of creating a duplicate |
| --installbool | Trigger: the install itself |
| --namestring | Goal name (unique per owner) |
| --no-valuebool | Tracked, not paid (value none) |
| --no-windowbool | Remove the window (update) |
| --not-payablebool | Campaign goal: track it, do not pay for it |
| --notifystring | Tell the traffic source when the goal is reached (default true): true, false (aliases: 0=false, 1=true, f=false, t=true)truefalse0 → false1 → truef → falset → true |
| --payoutstring | Campaign payout for reaching the goal (default: the goal's own value) |
| --registration-idstring | Owner: this app registration (p202 app list) |
| --repeatstring | How often it can be reached (default once): once, eachonceeach |
| --repeat-maxstring | With --repeat each: the most times it can be reached (1-10000; required for a --sum-prop goal) |
| --sum-gtestring | The running-sum threshold |
| --sum-propstring | Reached when the running sum of this property (or $revenue) reaches --sum-gte |
| --valuestring | Fixed value of reaching the goal, e.g. 4.00 |
| --value-from-propertystring | Value from an event property (default the event's revenue) |
| --wherestring | Conditions on the event, "<prop> <op> <value>", several separated by ; (ANDed); ops: eq, neq, gt, gte, lt, lte, in, exists |
| --within-daysstring | Only events within this many days of --within-from |
| --within-fromstring | Window anchor: install, clickinstallclick |
05How it works
Creates version 1 of a goal. Build the definition from the quick flags, or pass the whole JSON with --definition/--file. A campaign goal with a value is payable on its campaign straight away (--payout overrides the value there, --not-payable tracks it only).
06For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands goal create --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.
- This command writes. Add
--stagedto record it as a proposal a person applies withp202 change apply.
{
"path": "p202 goal create",
"use": "create",
"short": "Create a goal for a campaign, an app registration or the account",
"long": "Creates version 1 of a goal. Build the definition from the quick flags, or pass the\nwhole JSON with --definition/--file. A campaign goal with a value is payable on its\ncampaign straight away (--payout overrides the value there, --not-payable tracks it only).",
"runnable": true,
"flags": [
{
"name": "account",
"type": "bool",
"default": "false",
"usage": "Owner: the account (shared by every app)",
"required": false
},
{
"name": "after",
"type": "string",
"default": "",
"usage": "Goal ids that must be reached first, comma-separated",
"required": false
},
{
"name": "campaign-id",
"type": "string",
"default": "",
"usage": "Owner: this campaign (`p202 campaign list`)",
"required": false
},
{
"name": "count",
"type": "string",
"default": "",
"usage": "Reached on the Nth matching event (default 1)",
"required": false
},
{
"name": "definition",
"type": "string",
"default": "",
"usage": "The whole definition as JSON (exclusive with the quick flags)",
"required": false
},
{
"name": "event",
"type": "string",
"default": "",
"usage": "Trigger: the event name that reaches the goal",
"required": false
},
{
"name": "file",
"shorthand": "F",
"type": "string",
"default": "",
"usage": "Read the definition JSON from a file (- for stdin)",
"required": false
},
{
"name": "idempotency-key",
"type": "string",
"default": "",
"usage": "Retry-safe create: the server records the response under this key and replays it on a retry with the same key and payload instead of creating a duplicate",
"required": false
},
{
"name": "install",
"type": "bool",
"default": "false",
"usage": "Trigger: the install itself",
"required": false
},
{
"name": "name",
"type": "string",
"default": "",
"usage": "Goal name (unique per owner)",
"required": false
},
{
"name": "no-value",
"type": "bool",
"default": "false",
"usage": "Tracked, not paid (value none)",
"required": false
},
{
"name": "no-window",
"type": "bool",
"default": "false",
"usage": "Remove the window (update)",
"required": false
},
{
"name": "not-payable",
"type": "bool",
"default": "false",
"usage": "Campaign goal: track it, do not pay for it",
"required": false
},
{
"name": "notify",
"type": "string",
"default": "",
"usage": "Tell the traffic source when the goal is reached (default true): true, false (aliases: 0=false, 1=true, f=false, t=true)",
"allowed_values": [
"true",
"false"
],
"value_aliases": {
"0": "false",
"1": "true",
"f": "false",
"t": "true"
},
"required": false
},
{
"name": "payout",
"type": "string",
"default": "",
"usage": "Campaign payout for reaching the goal (default: the goal's own value)",
"required": false
},
{
"name": "registration-id",
"type": "string",
"default": "",
"usage": "Owner: this app registration (`p202 app list`)",
"required": false
},
{
"name": "repeat",
"type": "string",
"default": "",
"usage": "How often it can be reached (default once): once, each",
"allowed_values": [
"once",
"each"
],
"required": false
},
{
"name": "repeat-max",
"type": "string",
"default": "",
"usage": "With --repeat each: the most times it can be reached (1-10000; required for a --sum-prop goal)",
"required": false
},
{
"name": "sum-gte",
"type": "string",
"default": "",
"usage": "The running-sum threshold",
"required": false
},
{
"name": "sum-prop",
"type": "string",
"default": "",
"usage": "Reached when the running sum of this property (or $revenue) reaches --sum-gte",
"required": false
},
{
"name": "value",
"type": "string",
"default": "",
"usage": "Fixed value of reaching the goal, e.g. 4.00",
"required": false
},
{
"name": "value-from-property",
"type": "string",
"default": "",
"usage": "Value from an event property (default the event's revenue)",
"required": false
},
{
"name": "where",
"type": "string",
"default": "",
"usage": "Conditions on the event, \"<prop> <op> <value>\", several separated by ; (ANDed); ops: eq, neq, gt, gte, lt, lte, in, exists",
"required": false
},
{
"name": "within-days",
"type": "string",
"default": "",
"usage": "Only events within this many days of --within-from",
"required": false
},
{
"name": "within-from",
"type": "string",
"default": "",
"usage": "Window anchor: install, click",
"allowed_values": [
"install",
"click"
],
"required": false
}
]
}