Quickstart

Quickstart

Get SaaS Tracker running and send your first event in under 5 minutes.

This guide covers the hosted version. For self-hosting via Docker Compose, see the self-hosting guide.

1. Create an account

Go to app.saas-tracker.com and sign up. A workspace and API key are created automatically.

2. Install the SDK

npm install @saas-tracker/sdk

3. Initialise the tracker

Call new SaaSTracker() once at app startup — before rendering or routing.

import { SaaSTracker } from "@saas-tracker/sdk";
 
export const tracker = new SaaSTracker({
  apiKey: process.env.SAAS_TRACKER_API_KEY,   // from your workspace settings
  apiUrl: process.env.NEXT_PUBLIC_API_URL,     // e.g. https://api.saas-tracker.com
});
⚠️

Never expose your API key on the client side. Use NEXT_PUBLIC_API_URL for the ingest endpoint URL only.

4. Identify users

Call identify as soon as you know who the user is (after login, on session restore):

tracker.identify("user-123", {
  email: "user@example.com",
  plan: "growth",
  company: "Acme Corp",
  createdAt: "2025-01-15T10:00:00Z",
});

5. Track events

// Page views
tracker.track("page_view", { url: window.location.href, title: document.title });
 
// Feature usage
tracker.track("feature_used", { feature: "ai_chart", query_type: "funnel" });
 
// Conversion events
tracker.track("upgrade_clicked", { from_plan: "free", to_plan: "growth" });

6. Verify in the dashboard

Go to Trends in your dashboard. You should see events appearing within 30 seconds.

If no events appear after 2 minutes:

  1. Check the browser network tab for POST /ingest requests
  2. Verify your API key is correct in Settings
  3. Use Settings → Developer tools → Send test event to confirm the API is reachable

Self-hosting

SaaS Tracker ships as a Docker Compose stack.

Clone the repository

git clone https://github.com/saas-tracker/saas-tracker.git
cd saas-tracker

Copy and fill environment variables

cp infra/secrets/prod.yaml.template infra/secrets/.env.prod
# Edit infra/secrets/.env.prod with your values

Start services

docker compose -f infra/docker-compose.prod.yml up -d

Run migrations

docker compose exec api bunx prisma migrate deploy

Access the dashboard

The dashboard is available at https://app.yourdomain.com after Caddy issues a TLS certificate.


Next steps