Goal
Goals are metrics to track campaign success. This tutorial creates a Click goal to count clicks on the.cta-button element.
See the goal creation guide for more information.
Requirements
access token
Create the goal
Endpoint:
Example:
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create a click-tracking goal for an experiment using the Automation API goals endpoint.
.cta-button element.
See the goal creation guide for more information.
access tokenPOST https://api.kameleoon.com/goals
| Name | Type | Description |
|---|---|---|
| description | String | Goal description (for example, “Number of CTA clicks”). |
| name | String | Goal name (for example, “Clicks on CTA”). |
| siteId | String | The project’s siteId. |
| params | Object | Includes element selectors for click tracking. |
curl -L -X POST 'https://api.kameleoon.com/goals' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
--data-raw '{
"description": "Number of times CTA button was clicked",
"hasMultipleConversions": true,
"name": "Clicks on CTA",
"params": {
"customSelectors": [
{
"mode": "CUSTOM",
"selector": ".cta-button, #bloc-789"
}
]
},
"siteId": 29353,
"status": "ACTIVE",
"type": "CLICK"
}'
Was this page helpful?