Custom events
Custom events record actions that are not pageviews. They are useful for signups, purchases, form completions, button clicks and product interactions.
Track an event
window.purestats?.track('Signup Completed');
Event names should be human-readable and stable. Avoid dynamic names like Plan Clicked: Pro; use properties instead.
Add properties
window.purestats?.track('Plan Selected', {
plan: 'pro',
billing_cycle: 'annual'
});
Properties let you filter and group events without creating dozens of event names.
Server-side events
Use the Events API when the browser cannot reliably send the event, for example after a payment webhook or backend-only conversion. See Events API.
Events and goals
Any custom event can become a goal. After creating the goal, PureStats shows conversion count, conversion rate, conversion time and attribution by source, campaign and landing page.
Naming recommendations
- Use title case for event names:
Trial Started. - Use lowercase snake case for properties:
plan_id. - Keep names stable across releases.
- Do not include personal data in event names or properties.