Events and goals
A pageview says someone looked. An event says someone did something.
Send a custom event
With the default script, call plausible() with an event name. Properties are optional and are flat key and value pairs.
plausible("Signup", { props: { plan: "free" } })
If your code can run before the script has loaded, add this stub first. Calls made early are queued and sent when the script is ready.
window.plausible = window.plausible || function () {
(window.plausible.q = window.plausible.q || []).push(arguments)
}
Event names can be up to 120 characters. Properties are sent as text.
Tag elements with CSS classes
Use the tagged-events script (/js/script.tagged-events.js) to send an event when someone clicks a tagged element or submits a tagged form, with no JavaScript of your own.
<a href="/signup" class="plausible-event-name=Signup+Click plausible-event-plan=free">Sign up</a>
A + in a value becomes a space. A property is any class that starts with plausible-event- followed by the property name.
Revenue
With the revenue script, an event can carry an amount.
plausible("Purchase", { revenue: { amount: 29.99, currency: "USD" } })
Keep personal data out
Do not send names, email addresses, phone numbers or ID numbers in event names, properties or page addresses. The terms forbid it, and it is easier never to collect it.
Goals
A goal is a name plus one thing to count: a custom event, or a visit to a page. Add goals on a site's dashboard, under Goals. For each goal the dashboard shows:
- unique conversions: visitors who matched at least once;
- total conversions: every matching event;
- conversion rate: unique conversions as a share of the site's visitors in the period;
- revenue, when the matching events carry an amount in a single currency.
Goals apply to events that are already stored, so you can add one after the fact.
Funnels
A funnel is an ordered list of two to eight steps, each a page or an event. It counts how many visits reached each step in order and where they dropped off. Visitor identifiers change every day, so a person who starts on one day and finishes on the next counts as two visitors.