PureStats documentation

No-code events

Track clicks and form submissions in PureStats with CSS classes and data attributes. Name custom events, add safe properties and follow event privacy rules.

No-code events let marketers or site owners track common interactions without writing JavaScript event handlers.

CSS class tracking

Add a PureStats event class to a clickable element:

<a href="/register" class="purestats-event" data-purestats-event="Signup Clicked">
  Start free trial
</a>

When a visitor clicks the element, the tracker sends a custom event named Signup Clicked.

Data attributes

Use data attributes when you want explicit names and properties:

<button
  class="purestats-event"
  data-purestats-event="Plan Selected"
  data-purestats-plan="pro"
  data-purestats-location="pricing">
  Choose Pro
</button>

PureStats sends the event with properties:

{
  "plan": "pro",
  "location": "pricing"
}

Forms

Track a form submission by adding the same attributes to the <form> element. The tracker records the submit action, not the full form contents.

Privacy rules

Do not put email addresses, names, phone numbers or free-text form values into event properties. Use stable categories or IDs that are safe for analytics.

When to use JavaScript instead

Use the JavaScript API when the event depends on application state, backend validation or complex product logic.