Track custom goals
Signups, clicks and any event: from JavaScript, HTML attributes, your server or page visits.
Goals are the actions that matter on your website: signups, trial starts, downloads, newsletter subscriptions. For each one SuprAnalytics shows how many visitors completed it, the conversion rate, the revenue of those visitors, and the properties you send with it.
From JavaScript
window.supr("signup");
window.supr("start_trial", { plan: "pro", billing: "yearly" });To call supr() before the script has loaded (for example from code that runs early), add this stub before your code:
<script>window.supr=window.supr||function(){(supr.q=supr.q||[]).push(arguments)}</script>Calls made before the script loads are queued and sent once it's ready.
With HTML attributes
No JavaScript: a click on the element completes the goal. Every supr-goal-* attribute becomes a property (dashes turn into underscores).
<button supr-goal="start_trial" supr-goal-plan="pro">Start free trial</button> <a href="/report.pdf" supr-goal="download" supr-goal-file="report">Download</a>
For a goal when something scrolls into view, see Track scroll events.
From your server
For things that happen in your backend, like a confirmed email or a completed onboarding:
curl -X POST https://supranalytics.app/api/v1/goals \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"visitor_id": "<supr_visitor_id cookie>", "name": "signup", "props": {"plan": "pro"}}'See the API reference.
Page-visit goals
Reaching a page can be a goal too, with no code: on the dashboard's Goal panel, click + and give a name and a path, like /thanks or /docs/* (* matches anything). They count every visitor who saw a matching page, including past visits.
Names and properties
- Names are lowercased, spaces become
_, and they're cut at 64 characters:"Start Trial"isstart_trial. Use lowercase letters, digits,_and-. - Up to 10 properties per goal. Keys are cut at 32 characters, values at 255; objects and arrays are skipped.
- Properties show up in the goal's details on the dashboard, never on a public dashboard.
Want an email every time a goal is completed? Set up a goal alert. Want the goal at the top of the dashboard instead of revenue? Make it your #1 KPI.
AI agent or LLM? Read this page as Markdown