Track goals
A goal is anything you want more of: a page visit, a click, a scroll, or a custom event. Set one up with or without code.
A goal is a conversion you care about: a sign-up, a demo request, a download, a plan upgrade. Once a goal exists, every breakdown in Statsy gains a conversions column, so you can see which channel, page and campaign actually produces them.
The five kinds of goal
| Kind | Fires when | Code needed |
|---|---|---|
| Pageview | Somebody visits a page. Match by path, by wildcard such as /thanks*, or by exact match. | None |
| Click | Somebody clicks an element matching a CSS selector you enter in the dashboard. | None |
| Scroll | A visitor reaches a scroll depth you set, as a percentage of the page. | None |
| Outbound | Somebody clicks a link to another site. | None |
| Event | Your code calls statsy.goal('name'), or a clicked element carries data-statsy-goal. | A little |
Create a goal without writing code
Open Goals
In the site you want to measure, go to Goals and add a goal.
Give it a name and a kind
Name it for the thing that happened, not the page it happened on: Signup, not /thanks. Then pick the kind from the table above.
Set a default value, if it has one
A goal can carry a default value, which is useful when you know roughly what a demo request or a trial start is worth. Real money still comes from payments, not from goal values.
Track an event from your code
For anything the dashboard cannot see on its own — a form that submits over fetch, a step inside an app — call the event yourself and create a goal of the event kind with the same name.
statsy.goal('signup', { plan: 'pro' });
// Before the script has loaded, queue the call:
window.statsyq = window.statsyq || [];
statsyq.push(['goal', 'signup', { plan: 'pro' }]);Properties are optional and can be strings, numbers or booleans. The same thing works straight from HTML, with no JavaScript at all:
<button data-statsy-goal="signup" data-statsy-prop-plan="pro">Start free</button>Note. Some events are recorded with no setup at all: outbound link clicks as
outbound, file downloads asdownload, and clicks on hosted checkout links ascheckout_start. Scroll depth is recorded per page. Each can be turned off with a script attribute.
What to do with a goal
- Open a goal to see its breakdown: which sources and pages drive it.
- Filter any report by goal to see only the visitors who converted, or build a funnel that ends on it.
- Get a message the moment it fires with a goal alert.
Full detail, including goals created through the API and from the CLI, is in Goals.
Last updated · Markdown version