Skip to content
13 · Track more

Custom events

Measure the things that matter to you: signups, clicks, plays, purchases.

All pages

The tracker records pageviews on its own. Everything else, you send.

There are two ways, and they do the same thing. Use markup when the event is “someone clicked this element”. Use JavaScript when the event happens in your code.

In your markup

Add data-sonex-event to any element. Clicking it sends that event:

<button data-sonex-event="cta-click">Start free</button>

Extra data-sonex-event-* attributes become properties on the event:

<button
  data-sonex-event="cta-click"
  data-sonex-event-position="hero"
  data-sonex-event-plan="pro">
  Start free
</button>

That sends cta-click with position: "hero" and plan: "pro". Now you can tell your hero button from the same button in the footer, without inventing two event names.

In your JavaScript

window.sonex.track("signup");
window.sonex.track("signup", { plan: "pro", source: "pricing-page" });

Send it where the thing actually succeeded, not where it was attempted. A signup fired on button click counts people who tried; fired in your success handler, it counts people who made it. Those are different numbers, and only one of them is a signup.

Properties

Keep them low-cardinality: a plan name, a category, a variant. They are for slicing a count into groups you can compare.

Do not put unique values (emails, user ids, order numbers, full session ids) in properties. Every unique value is its own group, so the breakdown becomes a list with a count of 1 next to each row. That is not analysis, and it is personal data you did not need to send. Nothing in sonex asks you for it.

Tagging a whole site

data-tag on the script tag labels every event from that page, which is the clean way to separate environments or variants:

<script defer
  src="https://api.trysonex.com/sonex.js"
  data-website-id="YOUR_WEBSITE_ID"
  data-tag="staging"></script>

Filter by tag later to include or exclude it.

Identify

window.sonex.identify("user_123", { plan: "pro" });

identify attaches your own stable id to the current session, so visits from a known account tie together across devices instead of counting as strangers. It is for products where people log in.

Do not use identify on a public marketing site. There is nothing to identify, and it weakens the property you are selling.

Turning events into answers

An event count is a starting point. Make it a rate with a Goal, a path with a Funnel, or a credit assignment with Attribution. See Reports.

Next: Links and pixels.

Questions

Frequently asked.

Cookies, install and pricing, answered. Still stuck? Ask us anything .

01 Can sonex show revenue next to my traffic?

Yes. Connect Stripe or Polar with a read-only key and sonex reads revenue straight from your payment provider, per website. Revenue then appears as a focusable series on the Overview chart and as its own report, beside the traffic that earned it. No tracked event is needed for it to work.

02 Does sonex use cookies?

No. sonex sets no cookies and needs no consent banner. It counts visits without cookies, fingerprinting, or any personal data, so it is GDPR, PECR and CCPA-ready by default.

03 How do I install sonex?

Add one script tag to your site's <head> with your website id. It is a single lightweight tracker — no build step and no SDK required.

04 Is sonex a Google Analytics alternative?

Yes. sonex gives you the reports that matter — visitors, pages, referrers, funnels, revenue and a world map — without surveilling your audience or drowning you in configuration.

05 How is sonex priced?

By monthly tracked events. Free covers 2k events, Pro is $20/mo for 200k events, and Business is $200/mo for 2M events with team seats.

See what your traffic actually earns.

Revenue beside the visitors that produced it. No cookies, no credit card, no consent banner.

Get started