> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openrevenue.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Custom events

> Track signups, clicks, downloads, conversions, and other product actions with OpenRevenue custom events.

## Track method

After the tracker script loads, OpenRevenue exposes `window.openrevenue.track()`. Call it with a short event name when a meaningful action succeeds.

```ts app.ts theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
window.openrevenue.track("signup")
window.openrevenue.track("plan_selected", { plan: "pro" })

// npm: import { track } from "openrevenue"
// track("signup", { plan: "pro" })
```

| Name | Type | Description |
| - | - | - |
| `eventName` | string | The event label stored with the analytics event. Keep it stable so reports stay clean. |
| `properties` | object? | 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. |
| `path` | string | The current page path is captured with the event, so you can see where actions happen. |
| `sessionId` | string | 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 and attaches it to later events as `identified_id` in event properties. Pass `null` to clear. In the default storage-free mode the hash is kept in memory only, so call `identify` on every page load while the visitor is signed in. When a [visitor ID is stored](https://docs.openrevenue.com/advanced/cookies-and-consent.md#storage), the hash is also kept in `localStorage` as `_ova_uid`.

```ts app.ts theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
window.openrevenue.identify(user.id)
// later, after logout:
window.openrevenue.identify(null)

// npm: import { identify } from "openrevenue"
// identify(user.id)
```

> [!WARNING]
>
> Do not pass emails, names, phone numbers, or other personal data. Use an opaque account id from your own system. Identify is optional. Mention it in your privacy policy if you use it. Calling `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.

```tsx checkout.tsx theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
async function handleSubmit(event) {
  event.preventDefault()

  const result = await submitSignupForm()
  if (!result.ok) return

  window.openrevenue.identify(result.userId)
  window.openrevenue.track("signup")
}
```

```tsx pricing.tsx theme={"theme":{"light":"one-light","dark":"one-dark-pro"}}
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.

> [!TIP]
>
> If you need to compare events over time, treat event names like API names: stable, short, and boring.

## 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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.