Visitors allows you to send custom events to track user actions and conversions.
Sends a custom event.
The name of the event you want to track.
Optional object containing event properties
Any additional custom properties for this event.
Track clicks declaratively using HTML data attributes. No JavaScript required.
Add data-visitors-event to any clickable element (buttons, links, etc.):
Add additional data-visitors-* attributes to include event properties:
This sends a Signup event with properties { plan: "Pro", source: "hero" }.
For form submissions, it's best to use visitors.track() in your submit handler after validation succeeds. For example:
This ensures you only track successful submissions and events aren't tracked for failed validation failures.