Goals
Track an explicit success event
Emit and test a customer-defined event only after a real action succeeds.
Use a custom success event when your application can identify that an action completed successfully. Examples include an accepted waitlist signup, completed account request, or confirmed application submission.
Before you implement
- Install and verify the Site Insights beacon.
- Create or draft a custom-event goal in Optimly.
- Copy the exact event type shown in the goal rule.
- Identify the callback or state transition that occurs only after success.
Emit the event
<script>
window.optimly.track("conversion", { type: "waitlist_signup_completed" });
</script>
Call the browser API only after the real success condition. The queue bootstrap in the canonical snippet retains the call if the deferred beacon is still downloading.
The type must exactly match the configured goal. It is limited to 255 letters, numbers, spaces, and the characters _ . / : + -. Additional or nested properties are ignored.
React example
type OptimlyWindow = Window & {
optimly?: {
track: (eventName: "conversion", options: { type: string }) => void;
};
};
function recordWaitlistSuccess(): void {
const optimlyWindow: OptimlyWindow = window;
optimlyWindow.optimly?.track("conversion", {
type: "waitlist_signup_completed",
});
}
Invoke recordWaitlistSuccess after the successful server response, not in the submit button's click handler.
Test
- Start a goal test in Optimly.
- Perform the successful action once.
- Confirm the observation shows the exact event type.
- Review the goal as Confirmed outcome.
- Activate the goal only after reviewing the displayed rule.
If the event request is accepted but does not match, compare the event type character-for-character and confirm the active test belongs to the same Site Insights site.