Create analytics goal
analytics_create_goalCreate a destination-path goal for an analytics property, counting visits prospectively from creation. Use path-only destinations like /thanks; duplicates and unset properties return conflicts.
Instructions
Create a destination-URL goal via POST /api/v1/analytics/goals. The destination is a PATH starting with '/' (e.g. /thanks) — absolute URLs are rejected with invalid_goal; the goal always belongs to the property's own hostname. Counting is prospective from creation (within-visit attribution), no history backfill. 409 goal_exists on a duplicate destination; 409 property_not_set_up when the project has no analytics property yet. This changes live tracking on the user's site. Does not use credits.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Goal display name. | |
| projectId | No | Numeric project id (convenience shape; do not combine with propertyId). | |
| propertyId | No | Explicit analytics property id (primary target). Pass ALONE — combining with a project reference is rejected. When omitted, pass a project reference instead; that resolves only when the project has exactly one property (409 property_scope_ambiguous otherwise). | |
| destination | Yes | Destination path starting with '/', e.g. /thanks. Absolute URLs are rejected (path-only contract). | |
| projectUuid | No | Project UUID (alternative to projectId). |