Skip to main content

Endpoint

Creates a new goal or returns an existing goal if it already exists (upsert behavior). Goals are used to track conversions for custom events or pageviews.

Authentication

Requires a Plugins API token with write access.
string
required
Bearer token for authentication

Request Body

The request body accepts either a single goal or multiple goals (for bulk creation).

Single Goal Creation

string
required
Type of goal to createOptions:
  • Goal.CustomEvent - Track custom events
  • Goal.Pageview - Track pageview conversions
  • Goal.Revenue - Track revenue goals (requires Business plan)
object
required
Goal configuration object (structure varies by goal_type)

Custom Event Goal

string
required
Name of the custom event to trackRequirements:
  • Maximum length: 120 characters
  • Cannot be engagement (reserved)
  • Will be trimmed of leading/trailing whitespace
Examples: Signup, Purchase, Download
object
Custom properties filter for the goal (up to 3 properties)Requirements:
  • Maximum 3 properties per goal
  • Keys: 1-300 characters
  • Values: 1-2000 characters
  • Both keys and values must be strings
Example:

Pageview Goal

string
required
Page path to track as a goalRequirements:
  • Must start with /
  • Will be trimmed of leading/trailing whitespace
  • Leading slash is automatically added if missing
Examples: /pricing, /blog/*, /thank-you
object
Custom properties filter for the goal (up to 3 properties)

Revenue Goal (Business Plan)

string
required
Name of the revenue event to track
string
required
Currency code for revenue trackingRequirements:
  • Must be a valid ISO 4217 currency code
  • Cannot be changed once the goal is created
  • Each event name can only have one currency
Examples: USD, EUR, GBP
object
Custom properties filter for the goal (up to 3 properties)

Bulk Goal Creation

array
Array of goal objects (maximum 8 goals)Each goal object follows the same structure as single goal creation.

Response

array
Array of created or retrieved goals
string
Type of goal: Goal.CustomEvent, Goal.Pageview, or Goal.Revenue
integer
Unique identifier for the goal
string
Human-readable display name for the goal
  • For custom events: same as event_name
  • For pageviews: “Visit
string
Event name (for custom event and revenue goals)
string
Page path (for pageview goals)
string
Currency code (for revenue goals)
object
Custom properties filter configuration

Status Codes

  • 201 Created - Goal(s) created or retrieved successfully
  • 400 Bad Request - Invalid request parameters
  • 401 Unauthorized - Missing or invalid API token
  • 402 Payment Required - Revenue goals require Business plan upgrade
  • 422 Unprocessable Entity - Validation error

Examples

Create Custom Event Goal

Response:

Create Pageview Goal

Response:

Create Goal with Custom Properties

Response:

Create Revenue Goal (Business Plan)

Response:

Bulk Create Goals

Error Responses

Validation Error

Maximum Goals Reached

Note: Each site can have a maximum of 1,000 goals.

Upgrade Required (Revenue Goals)

Currency Mismatch

This error occurs when trying to create a revenue goal with a different currency for an event name that already exists with another currency.

Notes

  • Goals are created with upsert behavior - if a goal already exists, it will be returned instead of creating a duplicate
  • Display names are automatically generated: event name for custom events, “Visit ” for pageviews
  • Leading and trailing whitespace in event names and paths is automatically trimmed
  • Pageview goals automatically get a leading / if not provided
  • Revenue goals cannot be created for consolidated views
  • Once created, a revenue goal’s currency cannot be changed
  • Custom properties require the Props feature (available on certain plans)