Track Goal Event
track_goalRecord a custom goal completion, creating the goal on first use. Optionally attribute to a visitor via visitorUid, or leave anonymous.
Instructions
Record one completion of a custom goal. The goal is created on first use, so no setup call is needed; names are lowercase letters, digits, underscores, and hyphens, max 64 chars. Pass visitorUid (the _fs_vid cookie value of a visitor the tracking script has already seen) so the completion attaches to that visitor's sessions and source; omit it for an anonymous completion. Each call appends a completion, so repeating it counts the goal twice. Use track_payment for revenue, which records a payment goal on its own. Undo with delete_goals. Requires websiteId or domain with a workspace token.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Goal name: lowercase letters, numbers, underscores, hyphens only (max 64 chars). E.g. "newsletter_signup", "add-to-cart" | |
| domain | No | Website domain from list_websites (e.g. "example.com"). Alternative to websiteId with a workspace token. | |
| metadata | No | Up to 10 custom key-value pairs. Keys: lowercase, max 64 chars. Values: max 255 chars. | |
| websiteId | No | Website ID from list_websites. Required with a workspace token unless domain is given; ignored with a website key. | |
| visitorUid | No | Visitor UID from the _fs_vid browser cookie of a visitor the tracking script has seen. Omit to record an anonymous completion. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | No | Object with status and data: a confirmation message. The completion itself is written asynchronously and appears in get_goals shortly after. |