Tracking custom events

Fire a JavaScript call to track anything — form submits, video plays, a custom click.

Tracking custom events

Beyond the page views and clicks the tracker captures automatically, you can fire your own events from JavaScript whenever something interesting happens.

The API

window.netaj.track("event_name", { property: "value" });

The function is no-op-safe: if the tracker hasn't loaded yet (rare on slow networks), the call is dropped. You don't need to wrap it in a try/catch.

Examples

  • netaj.track("video_played", { id: "intro", duration: 45 })
  • netaj.track("checkout_step", { step: 2, value: 199.0 })
  • netaj.track("error_shown", { code: "PAYMENT_DECLINED" })

Using events as experiment goals

Once an event has been fired at least once, it shows up in the goal picker when you create a new experiment. Pick it, and that becomes your conversion definition.

Was this article helpful?