Create or redefine a goal
goals_saveCreate a goal, or redefine one with the same name: EVENT (an event name like signup, or name@/path for that event on one page: form_submit@/register is the signup form sent on /register, which t.js reports with no code on the site), PAGEVIEW (a path pattern like /welcome*), CTA (a data-sf value, * for a wildcard), ENGAGED, REVENUE (trial, paid), or CHECKOUT (a visit back from a hosted checkout such as Stripe or Dodo: a payment, seen without any code on the site; match is the return path pattern, * for any). Every goal you create is SOFT. Only the founder makes a goal HARD, in the results app, and the headline conversions count HARD goals once there are any; changing a HARD goal's definition puts it back to SOFT. Say why in note. stage puts it on the way to a payment: interest (clicks and pages before signing up, the signup page itself included), engaged, signup (a finished signup, each way of signing up is its own goal in this stage and the stage counts a session once), active (a signed-up person using the product), paying. Left out, it is read from the goal. A goal in signup or paying (or leaving one) needs ways: every way an account is created (or a payment confirmed) that you found in the code, each { way, where: file:line, covered: the goal that counts it, or "server" when the product's server sends the event (the users routine) }, and alsoCounts: what else the goal can count besides a new account or a payment, or "nothing". The save is refused while any way has nothing counting it. A way counted by a goal that does not exist yet: save that goal in the same call with alsoSave. Free.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"name": "<name>",
"type": "<type>"
},
"name": "goals_save"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | ||
| note | No | ||
| type | Yes | ||
| ways | No | Signup or paying stage: every way in from the code, each with what counts it | |
| match | No | Needed except for ENGAGED and CHECKOUT | |
| stage | No | ||
| siteId | No | ||
| alsoSave | No | Other goals in the same stage saved in this call, so ways can name them | |
| alsoCounts | No | Signup or paying stage: what else this goal can count (an existing email sent again, a rejected submit, a page logins also reach), or "nothing" | |
| valueCents | No |