01How it works
Define what counts (an install, an event with conditions, the Nth occurrence, a running sum, a step after another goal, a window), and which campaigns pay for it and how much.
p202 goal create --campaign-id 7 --name "Sale" --event sale --value 20 p202 goal create --registration-id 3 --name "Level 3" --event level_reached --where "level gte 3" p202 goal campaign set 12 7 --payout 4.00 p202 goal reevaluate 12 # preview; add --apply to apply
The full definition format is in documentation/api/22-goals.md; --definition takes it as JSON.
02Commands
11 under p202 goal.
03For agents
Running this from an agent
- Read the same facts as JSON:
p202 commands goal --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 goal",
"use": "goal",
"short": "Goals: what counts as a conversion, versioned, and which campaigns pay for it",
"long": "Define what counts (an install, an event with conditions, the Nth occurrence, a running\nsum, a step after another goal, a window), and which campaigns pay for it and how much.\n\n p202 goal create --campaign-id 7 --name \"Sale\" --event sale --value 20\n p202 goal create --registration-id 3 --name \"Level 3\" --event level_reached --where \"level gte 3\"\n p202 goal campaign set 12 7 --payout 4.00\n p202 goal reevaluate 12 # preview; add --apply to apply\n\nThe full definition format is in documentation/api/22-goals.md; --definition takes it as JSON.",
"aliases": [
"goals"
],
"runnable": false
}