Simple JavaScript API
Track any event with one line of code: openmetrica('Signup'). Add properties for more context: openmetrica('Purchase', { props: { plan: 'pro', revenue: '49' } }). No npm packages, no build step, no tag manager.
Go beyond pageviews. Track signups, purchases, downloads, form submissions, or any interaction with a simple JavaScript API. Attach key-value properties for granular segmentation. Auto-discovery finds properties you are already sending.
Illustrative events and properties
Track any event with one line of code: openmetrica('Signup'). Add properties for more context: openmetrica('Purchase', { props: { plan: 'pro', revenue: '49' } }). No npm packages, no build step, no tag manager.
Properties are key-value pairs attached to custom events. Register them in site settings and OpenMetrica auto-discovers properties already being sent by scanning your ClickHouse data. No manual guessing.
See top values for any registered property. For example, view all values of the plan property across your Purchase events, how many bought free vs pro vs business. Breakdown data is cached for performance.
OpenMetrica automatically detects client-side navigation in single-page apps. It hooks pushState and replaceState and listens for popstate, and it counts a new pageview only when the page path changes, so jumping to an anchor or updating the query string stays on the same page. Microtask debouncing prevents duplicate pageviews during redirect chains. An app that routes in the URL hash (#/about) is counted as a single page.
The tracker has a 1,177-byte gzip build budget and is loaded with defer. It sends events with sendBeacon, falling back to fetch with keepalive. Delivery still depends on the browser, network and privacy tools.
Identical submissions are deduplicated within the same fixed 5-second timestamp bucket, using a key that includes the event, properties, URL and visitor hash. Events across bucket boundaries can still be counted separately.
The tracker exposes a global openmetrica() function. Call it with an event name and optional properties. Events are validated server-side against a Zod schema, invalid payloads are rejected with a 400 status. Event names can be up to 100 characters. Property keys up to 50 characters, values up to 200 characters.
The auto-discovery feature scans your ClickHouse event data for custom properties that have been sent but not yet registered in your site settings. It shows discovered keys with event counts so you can register them with one click.
Properties belong to custom events, not to pageviews. To segment by content, send an event when the page is read: openmetrica('Article Read', { props: { author: 'John', category: 'tech' } }). It counts towards your monthly event allowance.
Answers before you get started.
Yes. Custom events require a JavaScript call, openmetrica('EventName'). Pageview tracking is automatic and requires no code. There is no point-and-click event setup because OpenMetrica values simplicity over magic.
The Free plan includes 5,000 events per month. Paid plans include half of their pageview step, from 50,000 events at 100K pageviews to 5 million at 10M. Event counts are tracked per month and reset automatically.
Events are raw tracking data, every time openmetrica('Signup') is called, an event is recorded. Goals are configured in settings to track conversion rates on specific events, pages, or scroll thresholds. You need events to power event-based goals.
Custom events are sent with the browser JavaScript function. The REST API reads your statistics and manages your site's setup; it does not record events.
Add one line of JavaScript and track any user action. No credit card, no complex setup.