Skip to main content
A custom event records an action that a pageview cannot see, like a signup, a checkout or a click on a pricing toggle. With the CrispStats script on the page, call crispstats("signup", { plan: "pro" }) where the action happens. The event appears under Events in the dashboard within seconds, with its count, unique visitors and a breakdown of every property you sent.

Send your first event

Once the script is installed, the global crispstats function is available on every page. Call it with an event name and, optionally, an object of properties:
A real handler looks like this:
The event is sent with navigator.sendBeacon (or fetch with keepalive when the beacon is refused), so it is delivered even when the click or submit navigates to another page. To track a click without writing JavaScript, use data-cs-event attributes instead. To send an event from your backend, such as a renewal from a webhook, see send events from your server.

Call crispstats() before the script loads

The script loads with defer, so inline code at the top of a page can run before it exists. Put this stub above the script tag. Calls made before the script loads are queued, then replayed in order once it starts:
It queues crispstats(), identify, revenue and pageview, and is safe to leave in place: the script replaces it with the real function. In a TypeScript app, use the module version and the global types from TypeScript instead.

Send events from your server

Actions that happen without a browser, such as a subscription renewal in a webhook or a job finishing in a queue, can be sent from your server with one POST to https://in.crispstats.com/e and a secret API key. Pass the visitor id you saved from crispstats.id() and the event joins that visitor’s history:
Server-side events covers the key, the payload and the status codes.

Event and property rules

Properties are a flat object. The script converts values before it sends them: The collector also checks each event against these limits:
The script does not shorten event names or property keys. A browser event with a name over 120 characters or a key over 60 characters is dropped without an error, because the collector answers a browser event that fails these checks with the same empty 202 as an accepted one. Keep names short and fixed.
An empty name sends nothing. Surrounding whitespace in a name is trimmed when the event is stored.

Naming events

  • Use the same name every time an action happens, like signup, so counts add up in one row.
  • Put the variable part in a property, not the name: crispstats("plan selected", { plan: "pro" }) rather than crispstats("pro plan selected").
  • Do not put personal data such as email addresses in names or property values. Use crispstats.identify() when you need to tie events to a signed-in user.
The tracker sends three event names itself when the matching modules are on: Outbound link, File download and 404. Avoid using those names for your own events.

When events are not sent

crispstats() is always defined once the script runs, but it sends nothing when the script is not tracking the page: on localhost without data-allow-localhost, on a hostname outside data-domains, on a path matched by data-exclude, in a browser that sends Do Not Track when the tag has data-dnt, in an automated browser, or in a browser where localStorage.crispstats_ignore is "1". Under data-manual, events before the first crispstats.pageview() are dropped too. Calls in those cases are harmless. To see each event and why it was not sent, add data-debug.

Where events show in the dashboard

Open Events in the site’s sidebar. The Events table lists the custom events sent in the selected range, up to 200 names, with their Count, unique Visitors and Last seen time. It adds Change when you compare periods and Revenue when an event carries revenue. Select an event to open Properties of that event: each property key with its values, how often each value was sent and its share. Select the event name there to filter the whole dashboard to visitors who sent it. To count an event as a conversion and see its conversion rate, add it as a goal. The events screen describes the page in full.

Next steps

Track clicks with attributes

Send events from HTML with data-cs-event, no JavaScript needed.

Identify signed-in users

Attach your own user id to the events a visitor sends.

Set up goals

Turn an event into a conversion with a rate you can track.
Last modified on November 18, 2026