Define the actions that trigger conversions in custom goals.
Goal events are used by custom goals to define what counts as a conversion. Each goal event type represents a specific action — a click, page view, or API custom event — that you can track. Custom goals listen for one or more goal events and count a conversion whenever one is triggered. You can reuse the same goal event in multiple custom goals.
Goal event types
There are three types of goal events you can create:
- Click — tracks when a visitor clicks specific page elements. You can define the page element with a CSS selector and optional JavaScript.
- Page view — tracks when a visitor loads a specific page. You can use JavaScript to add conditions — for example, checking whether a page element is visible or a certain variable is set.
-
Custom JavaScript — leverages the
sendEvent()API to track custom events. You write custom JavaScript on your site pages to define what the trigger is. You can also optionally include a value when calling the event.
Create a click event
Open your Optimize site in Webflow, then:
- Click Components in the Navigation panel
- Click the Events tab > New event
- Enter an event name
- Select A click for Event Type
- Choose a page definition for Goal Event Page
- Enter a Selector value that matches the element
- Optional: Enter JavaScript that evaluates to
trueorfalseif you want to refine when the click should count - Click Save
Good to know
If your goal includes JavaScript, it runs when the click occurs. The event only triggers if your code returns true.
Create a page view event
Open your Optimize site in Webflow, then:
- Click Components in the Navigation panel
- Click the Events tab > New event
- Enter an event name
- Select A page view for Event Type
- Choose a page definition for Goal Event Page
- Optional: Enter JavaScript that evaluates to
trueorfalseif you want to refine when the click should count - Click Save
Good to know
If your goal includes JavaScript, it runs when the page loads. The event only triggers if your code returns true.
Create custom JavaScript event (API)
Important
Requires the sendEvent() API. Your event apiName must match the apiName used in sendEvent().
Open your Optimize site in Webflow, then:
- Click Components in the Navigation panel
- Click the Events tab > New event
- Enter an event name
- Select A custom JavaScript event for Event Type
- Enter an apiName in the API field
- It must match the value passed to
sendEvent() - It must be 40 printable ASCII characters or fewer, and can’t contain spaces
- It must match the value passed to
- Click Save