Tracking custom events
Custom events let you measure actions that aren’t pageviews — signups, add-to-cart, button clicks, video plays, anything that matters to you.
Send an event in code
Call wazlytics() with a name and, optionally, some properties:
wazlytics('Signup', { props: { plan: 'pro' } })The name is whatever you choose — keep it short and consistent so it’s easy to read in reports.
Without writing code
You don’t need JavaScript. Tag any element — a button, link, or form — with a data-waz-event attribute, and Wazlytics fires that event when the element is clicked (or the form is submitted):
<button data-waz-event="Signup">Create account</button>To attach extra detail, add a data-waz-props attribute containing JSON — the no-code equivalent of the props object:
<a href="/pricing"
data-waz-event="Pricing click"
data-waz-props='{"location":"navbar"}'>Pricing</a>If you can’t edit attributes, a class token works too: class="waz-event-name=Signup". Tagged elements take precedence over the automatic outbound-link and download capture.
A real example: track your 404s
Wazlytics doesn’t guess which pages are errors, so a common use of a custom event is to flag them yourself. On your site’s 404 template, fire an event with the missing path:
wazlytics('404', { props: { path: location.pathname + location.search } })Create a goal for the 404 event (see below) and your broken URLs show up in the dashboard — the same recipe works for any action you want to count.
Turn an event into a conversion
Sending an event records it, but to track it as a conversion, create a matching custom event goal in Settings → Goals. From then on it shows up with a conversion rate and works in funnels — see Goals & conversion rate.
Note
Outbound Link: Click, File Download, and Form: Submission — are custom events too. You can build goals on them without writing any code.