Add goal
Add a pageview or custom event goal in the site settings.
POST https://cotlet.dev/api/v1/plausible/goals
write
Opens Goals in the site settings, clicks + Add goal and saves it. A custom event name must match what your site sends, including capitalisation. Plausible counts a goal only from the moment it exists and does not backfill, and shows it in the dashboard after its first conversion. It reaches no one, and the goal can be edited in the settings at any time.
Parameters
| Name | Type | Description |
|---|---|---|
| site string required | string | Domain of the site as the Sites page lists it, e.g. acme-shop.example. |
| trigger string required | string | pageview or custom_event. |
| target string required | string | Page path for a pageview goal (an asterisk matches a pattern, e.g. /blog*), exact event name for a custom event goal. |
| display_name string | string | Name shown in the Goals report. Default: Plausible fills it from the path or event name. |
Request
curl -X POST https://cotlet.dev/api/v1/plausible/goals \
-H "Authorization: Bearer $COTLET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"site":"acme-shop.example","trigger":"pageview","target":"/checkout/thank-you","display_name":"Checkout complete"}' result = client.call("plausible", "add_goal", {"site":"acme-shop.example","trigger":"pageview","target":"/checkout/thank-you","display_name":"Checkout complete"}) const result = await cotlet.call('plausible', 'add_goal', {"site":"acme-shop.example","trigger":"pageview","target":"/checkout/thank-you","display_name":"Checkout complete"}); cotlet call plausible add_goal --data '{"site":"acme-shop.example","trigger":"pageview","target":"/checkout/thank-you","display_name":"Checkout complete"}' Example response
{
"site": "acme-shop.example",
"name": "Checkout complete",
"trigger": "pageview",
"target": "/checkout/thank-you",
"status": "added"
}