Saasco logoSaasco logo
Saasco logoSaasco logo

Introduction

OverviewGetting startedWhat is Saasco?

SDK

Quick startTrackingIdentifyConfigurationWidgetsProperties

MCP

Quick startHow it worksAuthorizationTool reference

REST API

Quick start

Quick start

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

saasco-sdk is the browser SDK. One install covers page views, custom events, identify, the optional ad pixels, the AI support widget and the social-proof widget, all keyed off a single Project ID.

It is the only entry point that sees the browser, so sessions, referrers, UTM parameters and device details come from here rather than from the REST API.

Setup

Copy your Project ID

It's on Settings → Project in your dashboard. There is no API key involved. The SDK runs in your users' browsers and only ever writes into the project the id names.

Install

npm install saasco-sdk

Create one instance and export it:

lib/saasco.ts
import { Saasco } from "saasco-sdk";

export const saasco = new Saasco({ projectId: "YOUR-PROJECT-ID" });

Drop one tag in just before </body>. It constructs the instance and calls init() for you, and exposes it as window.saasco:

<script
  src="https://www.saasco.com/sdk/saasco-sdk.js"
  data-projectId="YOUR-PROJECT-ID"
  async
></script>

Common constructor options map to data-* attributes. See Configuration. Skip the next step; you're already initialized.

Call init() once

init() is what starts automatic page tracking and injects the widget loaders. Constructing new Saasco(...) on its own does neither.

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

saasco.init();

In the Next.js App Router, wrap it in a client component so it only runs in the browser:

components/SaascoAnalytics.tsx
"use client";

import { useEffect } from "react";

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

export function SaascoAnalytics() {
  useEffect(() => {
    saasco.init();
  }, []);

  return null;
}

Then render <SaascoAnalytics /> from your root layout.

Verify

Load a page with ?saasco-debug=true on the URL and watch the console. Every event the SDK sends is logged. Then open Analytics → Events in the dashboard; the Page View should be there within a few seconds.

If nothing arrives, check that init() actually ran (the debug log starts with Saasco started) and that enabled isn't false for this environment. Coding agents can check from the terminal instead; see Setup for coding agents.

What you get from here

Tracking

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

Identify

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

Configuration

Every constructor option, script-tag attribute, debug switch and ad pixel.

Widgets

The AI support widget and social-proof notifications.

  • Setup for coding agents: the whole install, identify, sign-up events and verification on one page.
  • Tracking: page views, custom events, and sending events from a server.
  • Identify: tie events to a CRM contact.
  • Configuration: every constructor option, script-tag attribute, debug switch and ad pixel.
  • Widgets: the AI support widget and social-proof notifications.
  • All docs as plain text, and the index.

Development and staging

On localhost, hosting-provider preview deployments and staging.-style subdomains, the SDK sends to your test project (test_YOUR-PROJECT-ID) by itself. Pass test: true on any other non-production host so only production reaches the live one. Test data stays out of your live dashboard, and test usage is free up to a monthly allowance. See Test and live.

To send nothing at all outside production, gate it instead:

lib/saasco.ts
export const saasco = new Saasco({
  projectId: "YOUR-PROJECT-ID",
  enabled: process.env.NODE_ENV === "production",
});

Debug logging still works while enabled is false. The events just aren't sent.

Privacy

By default the SDK tracks nobody in particular: activity sits behind an anonymous visitor id and a session id, stored in first-party saasco-sdk-* cookies on your own root domain (about a year for the visitor, 30 minutes for the session). Personal data only enters when you identify someone.

What is Saasco?

An all-in-one marketing stack for SaaS companies. Connect once and only pay for what you use.

Tracking

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

On this page

SetupCopy your Project IDInstallCall init() onceVerifyWhat you get from hereDevelopment and stagingPrivacy