Saasco logoSaasco logo
Saasco logoSaasco logo

Introduction

OverviewGetting startedWhat is Saasco?

SDK

Quick startTrackingIdentifyConfigurationWidgetsProperties

MCP

Quick startHow it worksAuthorizationTool reference

REST API

Quick start

Tracking

Page views, custom events, and sending events from your server.

Page views

init() starts automatic page-view tracking. By default every URL change is recorded, including query-parameter and hash changes:

const saasco = new Saasco({
  projectId: "YOUR-PROJECT-ID",
  autoPageTracking: {
    enabled: true,
    trackQueryParams: true,
    trackHash: true,
  },
});

saasco.init();

Leave the defaults unless you have a reason not to. Turning off trackQueryParams is the usual one: a filter UI that writes state into the URL will otherwise record a page view per keystroke.

Recording page views yourself

Set autoPageTracking.enabled: false and call page() on each route change. The event name is Page View, the same as the automatic one.

const saasco = new Saasco({
  projectId: "YOUR-PROJECT-ID",
  autoPageTracking: { enabled: false },
});

saasco.init();

// after a client-side navigation
saasco.page();

Don't leave automatic tracking on and call page(), or you'll double-count.

page() is browser-only and dedupes against the last recorded path (including query and hash when those options are on), so calling it twice for the same URL is a no-op.

Custom events

An event is a name and an optional bag of properties.

Name the action, past tense, object first: Searched Movies, Started Trial, Invited Teammate. We follow Segment's object-action framework, which keeps the event list readable once it's a hundred long.

import { saasco } from "../lib/saasco";

saasco.track("Searched Movies");

saasco.track("Searched Movies", {
  query: "batman",
  sortBy: "relevancy",
});

Client-side calls pick up the userId from whatever identify call happened during the session, so you don't pass it.

From a server

On the server there is no session to read from, so use the object form and pass either a userId or an anonymousId you captured on the client:

import { saasco } from "../lib/saasco";

saasco.track({
  event: "Signed Up",
  userId: "user_123",
  properties: {
    provider: "email",
  },
});

Without one of those there is no contact to attach the event to.

Revenue properties

Three property names are read by the analytics and CRM views rather than being stored as plain attributes:

PropertyTypeDescription
revenueNumberRevenue this event produced, as a decimal.
currencyStringISO 4217 currency for revenue.
valueNumberAbstract score used internally for things like lead scoring.

Send revenue and currency together on purchase-shaped events and per-source revenue and customer LTV work without further setup.

Reserved events

These names describe the common lifecycle moments. Nothing breaks if you use your own, but matching these lets Saasco line up funnels and revenue without a mapping step:

  • Signed Up
  • Signed In
  • Signed Out
  • Trial Started
  • Trial Ended
  • Payment Completed
  • Subscription Started
  • Subscription Cancelled
  • Subscription Upgraded
  • Subscription Downgraded

Each accepts optional properties (plan, provider, revenue, currency and friends) documented alongside the default event properties.

What the SDK attaches for you

Every client-side event carries browser and campaign context under $-prefixed keys: the URL and page title, screen and locale, referrer, and the session's UTM parameters and ad ids. Geo, device, OS and browser are filled in by the ingest pipeline from the IP and user agent.

Avoid a leading $ in your own property names so nothing collides. The full list is in Properties.

Quick start

Install saasco-sdk, send your first page view, and see it land in the dashboard.

Identify

Tie anonymous activity to a CRM contact, before or after they have an account.

On this page

Page viewsRecording page views yourselfCustom eventsFrom a serverRevenue propertiesReserved eventsWhat the SDK attaches for you