List goals for a website
Path Parameters
Website ID (format:
site_*)Response (200 OK)
Array of goal objects
Response Example
Create a goal
Maximum of 50 goals per website. Creating more will return a
422 Unprocessable Entity error.Path Parameters
Website ID (format:
site_*)Request Body
Goal display name (1-100 characters, must not be empty or whitespace-only)Must be unique per website — duplicate names return a
422 error.Type of goal:
event— Match custom event names (tracked viawindow.sparklytics.track('event_name'))pageview— Match page URLs
Value to match (1-500 characters)
- For
event: event name (e.g.,signup_click) - For
pageview: URL path (e.g.,/thank-you,/checkout)
How to match the value:
equals— Exact match (default)starts_with— Value starts with match_valueends_with— Value ends with match_valuecontains— Value contains match_value
How to track goal value:
none— No value tracking (default)fixed— Use a fixed numeric value (requiresfixed_value)event_property— Extract value from event property (requiresvalue_property_key)
Fixed numeric value (required when
value_mode=fixed, must be non-negative)Example: 99.0 for a $99 conversionEvent property key to extract value from (required when
value_mode=event_property)Example: If you track window.sparklytics.track('purchase', { amount: 49.99 }), use "amount"Currency code (1-8 characters, e.g.,
USD, EUR, GBP)Response (201 Created)
Created goal object (same structure as in list endpoint)
Response Example
Error Responses
422 Unprocessable Entity
Validation errors:Duplicate name:Limit exceeded:Invalid name:Missing fixed_value:
404 Not Found
Website does not exist
Update a goal
Path Parameters
Website ID (format:
site_*)Goal ID (format:
goal_*)Request Body
All fields are optional. Only provided fields will be updated.New goal name (must be unique per website, 1-100 characters)
New match value (1-500 characters)
New match operator:
equals, starts_with, ends_with, or containsNew value mode:
none, fixed, or event_propertyNew fixed value (must be non-negative)
New event property key
New currency code (1-8 characters)
Response (200 OK)
Updated goal object (same structure as in list endpoint)
Error Responses
422 Unprocessable Entity
Validation errors (same as create endpoint)
404 Not Found
Website or goal does not exist
Delete a goal
Path Parameters
Website ID (format:
site_*)Goal ID (format:
goal_*)Response (204 No Content)
Empty response body on successful deletion.Error Responses
404 Not Found
Website or goal does not exist
Get goal statistics
Returns conversion metrics for a specific goal over a date range.Path Parameters
Website ID (format:
site_*)Goal ID (format:
goal_*)Query Parameters
Start date in
YYYY-MM-DD format (defaults to 6 days before end_date)End date in
YYYY-MM-DD format (defaults to today)IANA timezone for date range calculation (defaults to website’s timezone)
Filter by ISO country code (e.g.,
US, GB)Filter by page URL path
Filter by referrer domain
Filter by browser name (e.g.,
Chrome, Safari)Filter by operating system (e.g.,
macOS, Windows)Filter by device type:
desktop, mobile, or tabletFilter by browser language (e.g.,
en-US)Filter by UTM source parameter
Filter by UTM medium parameter
Filter by UTM campaign parameter
Filter by region/state (e.g.,
California, TX)Filter by city name
Filter by hostname (useful for multi-domain tracking)
Include bot traffic (defaults to website’s bot policy setting)
Response (200 OK)
Response Example
Error Responses
404 Not Found
Website or goal does not exist
Goal Types
Event Goals
Track custom JavaScript events triggered by user actions. Example: Track signup button clicksPageview Goals
Track visits to specific pages (e.g., thank-you pages, checkout completion). Example: Track checkout completions/checkout/success.
Value Tracking
Fixed Value
Assign a fixed monetary value to each conversion.Event Property Value
Extract value from event data (useful for dynamic pricing).49.99 from the amount property.