Goals & conversions
A goal is any conversion you care about — signup, purchase, pro_upgrade. Fire it from your site and Statlark ranks your sources, pages, and revenue by it. Nothing to configure in the dashboard first — goals appear the moment they fire.
Fire a goal
Call goal() the moment the conversion happens, or use a data-statlark-goal attribute to fire one on click with no JavaScript.
// Fire a goal the moment a conversion happens — e.g. right after signup.
// The script is deferred, so guard for it.
window.statlark?.goal("signup");
// Attach properties to segment it later (e.g. by plan).
window.statlark?.goal("pro_upgrade", { plan: "pro" });<!-- Or fire one on click, no JavaScript required. -->
<button data-statlark-goal="signup">Create account</button>
<!-- With properties, as a JSON attribute. -->
<button data-statlark-goal="pro_upgrade" data-statlark-props='{"plan":"pro"}'>
Upgrade
</button>The first time a goal fires it shows up on the Goals tab with its conversion rate, top sources, and entry pages — and, once Stripe is connected, the revenue it drove.
Segment by property
Attach properties to a goal to break it down later — say plan or product. Pass them as the second argument to goal(), or declaratively with data-statlark-goal-* attributes (a data-statlark-props JSON blob works too).
// Pass properties as the second argument to segment the goal later.
window.statlark?.goal("pro_upgrade", { plan: "pro", seats: 5 });<!-- Declaratively: one attribute per property (kebab-case → snake_case). -->
<button data-statlark-goal="pro_upgrade" data-statlark-goal-plan="pro">
Upgrade
</button>Keep properties small: up to 20 per goal, keys up to 64 characters, values up to 500. Values should be strings, numbers, or true/false — anything else is dropped.
On the Goals tab, the Conversion by property section lets you pick a property and see conversions split across its values — how many pro_upgrades came from each plan, say.
Pick your #1 KPI
One goal can be your north-star metric. Set it under Settings → Your #1 KPI, or hit Set as #1 KPIon the Goals tab. The Goals and Pages screens then default to ranking by that goal instead of revenue — handy when signups, not dollars, are what you’re optimising today.
Reserved Stripe goals
Once you connect Stripe, Statlark emits lifecycle goals automatically from the payments it already sees — no extra instrumentation:
payment— every successful payment (one-time or subscription).subscription_started— the first invoice of a new subscription.subscription_renewed— each renewal invoice.
They behave like any other goal — rank them by source, chart them over time, and set one as your #1 KPI or alert on it. (A payment only becomes a goal once it’s attributed to a visitor; unattributed payments still count as revenue.)
Conversion alerts
Get an email the moment a goal fires — your own cha-ching. Under Settings → Conversion alerts, pick a goal, enter where to send it, and you’re done. It works for goals you fire and the reserved Stripe goals alike, so you can be emailed on every payment without writing any code.