Install TrackStack in two minutes
Add a website in the app to get your website ID, paste one script tag, and connect payments when you're ready.
Install the script
Paste this in the <head> of every page. Replace the ID with the one shown in the app.
<script
defer
data-website-id="ts_your_website_id"
src="https://trackstack.altuzar.dev/js/script.js"
></script>Pageviews, single-page-app navigation, referrers, UTM tags and a 30-second heartbeat for "online now" are tracked automatically. The app shows a green check as soon as the first visit arrives.
Optional attributes:
data-cookielesskeeps IDs in session storage instead of cookies.data-domain="example.com"shares the visitor ID across subdomains.data-allow-localhosttracks local development traffic.
Frameworks
Next.js (app/layout.tsx):
import Script from "next/script"
<Script
defer
data-website-id="ts_your_website_id"
src="https://trackstack.altuzar.dev/js/script.js"
strategy="afterInteractive"
/>Webflow, Framer, Wix, Squarespace, WordPress, Ghost, Shopify: paste the script tag in the site-wide custom code or header section.
Install with AI: in the app, tap "Copy AI prompt" and paste it into Cursor, Claude Code or Codex. It adds the script in the right place for your framework.
Track goals
Goals count actions like sign-ups. Add an attribute to any element:
<button data-ts-goal="signup">Create account</button>Or call it from JavaScript:
window.trackstack("goal", "checkout_started")Goal names are lowercase letters, numbers, dashes and underscores, up to 64 characters.
Connect revenue
Stripe. In the app, open your site, choose Stripe and paste a restricted key with read access to Checkout Sessions, Invoices, Charges and Refunds. TrackStack syncs every 15 minutes. To attribute each payment to the visit that earned it, pass the visitor ID when you create the Checkout Session:
// In the browser, before redirecting to checkout
const visitorId = window.trackstack?.visitorId()
// On your server
await stripe.checkout.sessions.create({
// ...
metadata: { trackstack_visitor_id: visitorId },
})Polar, Lemon Squeezy, Paddle, Shopify or your own backend. Send each payment from your webhook handler with your site secret (Site settings, Revenue):
curl -X POST https://trackstack.altuzar.dev/api/v1/payments \
-H "Authorization: Bearer tss_your_site_secret" \
-H "Content-Type: application/json" \
-d '{
"id": "order_123",
"amount": 4900,
"currency": "usd",
"visitor_id": "tsv_...",
"email": "buyer@example.com",
"customer_id": "cus_123",
"type": "new"
}'amount is in cents. type is new, renewal or refund. Renewals with a known customer_id inherit the original attribution.
API, CLI and MCP
Create an API key in Settings, API and MCP. Keys start with tsk_ and are shown once.
REST:
curl "https://trackstack.altuzar.dev/api/v1/stats?site=example.com&period=last7&compare=1" \
-H "Authorization: Bearer tsk_..."Periods: now, today, yesterday, last7, last30, last90, thisMonth, lastMonth, last12m, ytd.
CLI:
export TRACKSTACK_API_KEY=tsk_...
npx trackstack sites
npx trackstack stats example.com --period last30 --compareMCP (Streamable HTTP) for Claude, Cursor, Codex and other agents:
claude mcp add --transport http trackstack https://trackstack.altuzar.dev/mcp \
--header "Authorization: Bearer tsk_..."Tools: list_sites, get_stats, compare_periods.
Privacy options
- No IP addresses are stored. Location comes from the edge and is kept at city level.
- Exclude paths like /admin in Site settings.
- Turn on cookieless mode with
data-cookieless. - Bots and AI crawlers are filtered out of visitor counts.