How to Track Custom Events in statpx: Clicks, Downloads, and Everything Else
Pageviews only tell you where a visitor went. Events in statpx tell you what they did once they got there — clicked a button, played a video, copied a discount code, closed a modal without acting. A single global function, _st('event', ...), covers all of it, and two of the most common events — outbound link clicks and file downloads — are already tracked automatically with zero code. This guide covers the event API and what shows up on the Events page.
The _st('event', ...) API
The call signature is _st('event', name, category, value, options). Only name is required — the rest let you slice the same event by category and by a rough value:
Fire the call at the exact moment the interaction happens — inside a click handler, a video play listener, or a modal-close callback. Event names and categories are free text, but keep them consistent across your codebase (e.g. always video-play, never mixing in videoPlay) so the Events page groups them correctly instead of splitting one action into two rows.
Adding Revenue and Custom Properties
For events tied to a dollar value or that need extra structured detail, pass a fifth argument — an options object with revenue and props:
The revenue field rolls up into totals on the Events page, letting you see which non-purchase interactions — like clicking "Upgrade" from inside the app — are correlated with revenue. props is a free-form object for anything else worth recording, like plan name or seat count, without needing a new event type for every variation.
Automatic Outbound-Link and File-Download Tracking
Two events fire without you writing anything: any click on a link pointing to a different domain is recorded as an outbound-link click, and any click on a link to a common downloadable file type (PDF, ZIP, DOC, and similar) is recorded as a file download. Both appear on the Events page alongside your custom events, tagged with the destination URL or file name, so you can see exactly which external links and files visitors actually engage with.
history.pushState, so route changes in React/Vue-style apps are captured without a full page reload — useful context when an event fires right after a client-side navigation.Reading the Events Page
The Events page lists every distinct event name with its total count, unique sessions, and — where present — total revenue, over the selected date range. Sort by count to find your most common interactions, or by revenue to find which actions actually correlate with money changing hands. Combine two or three events into a funnel to see the order visitors move through them, or read our deeper guide on custom event tracking for naming conventions and event design patterns.
Track any interaction free
statpx events cover clicks, video plays, form actions, and revenue-tied interactions — plus automatic outbound-link and download tracking out of the box.
Start for free →The Bottom Line
Events are the flexible layer beneath every other statpx feature — Goals, Funnels, and A/B Testing all ultimately consume the same _st('event', ...) calls under the hood. Start by instrumenting the two or three actions that matter most to your business, keep names consistent, attach revenue wherever real money is involved, and let the automatic outbound-link and download tracking fill in the rest without any extra code.