kopairDocumentation
Dashboard ↗
Documentation / Define success

Custom events

Send a named success event from the actual successful action in your site code.

Reviewed: 25.10.2026 · Based on current product behavior

Step by step

  1. Create a custom_event site goal with a stable event name, for example lead_submit. Attach it to the experiment before launch.
  2. Ask a developer to call window.kopair.track('lead_submit') in the form or application success callback after the SDK is ready and analytics is allowed.
  3. Do not send email, order details or form values as event names. Avoid calling the same event from both a click listener and a success handler.
// Inside a confirmed success callback, after SDK readiness
window.kopair.track('lead_submit');
Practical example

An AJAX form on WordPress stays on the same page: emit lead_submit only when the form plugin reports success. On Tilda a thank-you redirect may be simpler. Shopify checkout pixels cannot be assumed to call the storefront window.kopair.

How to verify

A rejected or invalid submission must not trigger the event. Test one successful submission in the intended running experiment and allow for report delivery delay. Optional chaining avoids an exception when the SDK is absent, but does not queue a lost event.