Custom events
Track important user actions such as signups, downloads, form submissions, and feature clicks.
Track method
After the tracker script loads, OpenRevenue exposes window.openrevenue.track(). Call it with a short event name when a meaningful action succeeds.
window.openrevenue.track("signup")window.openrevenue.track("plan_selected", { plan: "pro" }) // npm: import { track } from "openrevenue"// track("signup", { plan: "pro" })window.openrevenue.track("signup")window.openrevenue.track("plan_selected", { plan: "pro" }) // npm: import { track } from "openrevenue"// track("signup", { plan: "pro" })eventNamestring
The event label stored with the analytics event. Keep it stable so reports stay clean.
propertiesobject?
Optional flat string/number/boolean props (up to 10 keys). Stored with the event for export and future breakdowns.
type"custom"
The tracker sends custom events with the custom event type automatically.
pathstring
The current page path is captured with the event, so you can see where actions happen.
sessionIdstring
The browser session ID is attached so the event can be connected to the visit.
Identify
After a visitor signs in, call identify with your product's stable user id (never an email or name). OpenRevenue hashes the value with SHA-256 in the browser, stores the hash in localStorage as _ova_uid, and attaches it to later events as identified_id in event properties. Pass null to clear.
window.openrevenue.identify(user.id)// later, after logout:window.openrevenue.identify(null) // npm: import { identify } from "openrevenue"// identify(user.id)window.openrevenue.identify(user.id)// later, after logout:window.openrevenue.identify(null) // npm: import { identify } from "openrevenue"// identify(user.id)track right after identify is safe — the tracker waits for the hash before sending.Examples
Track the moment that matters, not every click. For forms, call OpenRevenue after validation and the server action both succeed.
async function handleSubmit(event) { event.preventDefault() const result = await submitSignupForm() if (!result.ok) return window.openrevenue.identify(result.userId) window.openrevenue.track("signup")}async function handleSubmit(event) { event.preventDefault() const result = await submitSignupForm() if (!result.ok) return window.openrevenue.identify(result.userId) window.openrevenue.track("signup")}function handlePlanClick(plan) { window.openrevenue.track(`plan_selected_${plan}`)}function handlePlanClick(plan) { window.openrevenue.track(`plan_selected_${plan}`)}Naming
Use lowercase, predictable names such as signup, download_report, or contact_submit. Avoid dynamic values like email addresses, order IDs, or full URLs in event names.
Where to see events
Custom events appear in your project analytics and count toward monthly usage alongside pageviews. Pings, outbound links, transactions, and performance events are tracked separately and do not count toward monthly event usage.