outlit-sdk

Use when integrating Outlit tracking into web, server, native, or desktop apps; adding SDK event tracking, identity, consent, activation, billing, visitor tracking, customerId attribution, or troubleshooting @outlit/browser, @outlit/node, or the Rust outlit crate.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "outlit-sdk" with this command: npx skills add leo-paz/outlit-sdk

Outlit SDK Integration

Decision-tree guide for adding product and website tracking to the Outlit customer context graph. Detect first, ask only when needed, keep changes small, and prefer official docs for framework-specific code.

This skill has no runtime credential requirement of its own. Environment variable names in this guide, such as NEXT_PUBLIC_OUTLIT_KEY or OUTLIT_KEY, are examples for the target application being instrumented.

Branching Check

Before anything else, check whether Outlit is already installed:

  1. Look for @outlit/browser, @outlit/node, outlit in Cargo.toml, https://cdn.outlit.ai, or existing outlit.init(...) / new Outlit(...) calls.
  2. If not installed, go to Phase 1: Quick Connect.
  3. If installed, go to Already Installed.

Already Installed

Ask what they need help with, then run detection before changing code:

Current API Guardrails

These points prevent the most common stale integrations:

  • All current ingest SDKs use publicKey values that start with pk_. Do not use privateKey, OUTLIT_PRIVATE_KEY, visitorId, or event for @outlit/node examples.
  • Node server events use new Outlit({ publicKey }) and track({ eventName, email | userId | fingerprint | customerId, properties }).
  • Browser anonymous events are valid without identity. Server track() requires at least one of email, userId, fingerprint, or customerId.
  • Server identify() requires email or userId. customerId is optional account/workspace attribution, not a user identity by itself.
  • Use customerId for your system-owned account/workspace/customer ID. The TypeScript SDK no longer uses customerDomain; do not add it.
  • Browser setUser() can be called before tracking is enabled and will be applied after consent. Browser identify() requires tracking to already be enabled.
  • user.activate() is the only journey stage new integrations should send manually. user.engaged() and user.inactive() are deprecated; Outlit derives engagement and inactivity from tracked product activity.
  • Billing is account-level. In TypeScript billing methods, prefer customerId; stripeCustomerId is compatibility-only. In Rust billing methods still start with a domain and can add .customer_id(...).
  • Event names should be snake_case. SDK events get UUIDv7 event IDs automatically; do not generate event IDs manually.

Phase 1: Quick Connect

Goal: get data flowing quickly so the user can see Outlit connection/activity without making product-strategy decisions.

Step 1: Detect Framework and Package Manager

Check:

SignalHow to detect
Frameworkpackage.json deps: next, react, vue, nuxt, svelte, @sveltejs/kit, @angular/core, astro, express, fastify, electron, react-native; Cargo.toml deps: tauri, outlit
Package managerbun.lockb, bun.lock, pnpm-lock.yaml, yarn.lock, package-lock.json
Current Outlit@outlit/browser, @outlit/node, CDN script, Rust crate, outlit.init, OutlitProvider, OutlitPlugin, new Outlit

Step 2: Choose SDK

App surfaceUse
Browser app: React, Next.js, Vue, Nuxt, SvelteKit, Angular, Astro, vanilla, script tag@outlit/browser
Node backend: API routes, server actions, Express, Fastify, jobs, webhooks@outlit/node
Native JS without browser storage: React Native, CLI, desktop main process@outlit/node with a stable fingerprint
Rust backend, CLI, or Tauri backendRust crate outlit
Electron renderer or webview@outlit/browser; use @outlit/node in main process only if tracking native/background events

Install with the detected manager. Prefer bun add when the repo is a Bun workspace.

Step 3: Add Public Key

Ask for the Outlit public key from Outlit dashboard -> Settings -> Website Tracking or onboarding.

Use the framework's public env convention:

FrameworkEnv var
Next.jsNEXT_PUBLIC_OUTLIT_KEY
Vite / Vue / React+Vite / SvelteVITE_OUTLIT_KEY
SvelteKitPUBLIC_OUTLIT_KEY
NuxtNUXT_PUBLIC_OUTLIT_KEY
AstroPUBLIC_OUTLIT_KEY
Create React AppREACT_APP_OUTLIT_KEY
Angularenvironment.ts or equivalent
Server/nativeOUTLIT_KEY or OUTLIT_PUBLIC_KEY

Step 4: Minimal Setup

Fetch the framework doc from the Doc URL Map and implement only startup initialization:

  • React/Next: prefer OutlitProvider from @outlit/browser/react in a client boundary.
  • Vue/Nuxt: use OutlitPlugin from @outlit/browser/vue.
  • Plain browser/script: use @outlit/browser or CDN script.
  • Server/native: create one Outlit instance where the process can reuse it.

Do not add custom events, activation, billing, auth, or consent until basic tracking is working unless the user asked for a full integration immediately.

Step 5: Verify Connection

Verify with one or more:

  • DevTools Network has https://app.outlit.ai/api/i/v1/<publicKey>/events returning success.
  • Browser console has no [Outlit] warnings.
  • Server code calls await outlit.flush() or await outlit.shutdown() before process/serverless exit.
  • Outlit onboarding/dashboard shows recent activity or connected tracking.

Then ask whether to continue with the full integration.

Phase 2: Full Integration

Run detection and present what you found before changing behavior:

SignalHow to detect
Auth provider@clerk/*, next-auth, @auth/core, @supabase/*, @auth0/*, firebase, custom session/auth files
Account modelorganization, workspace, team, account, tenant, customerId, Stripe customer mapping
Billing providerstripe, @stripe/stripe-js, paddle, chargebee, webhook routes
Existing analyticsposthog-js, @posthog/node, Amplitude, Mixpanel, Segment, analytics wrappers
ConsentCookiebot, OneTrust, cookie banner components, CMP callbacks
Native/deviceTauri, Electron main process, React Native, CLI, mobile storage
Activationfirst workspace/project/resource, first successful integration, invite sent, report generated, first meaningful feature success
Calendar embedsCal.com or Calendly embed code

Decision 1: Consent

DetectionRecommendation
Existing CMP/cookie bannerInitialize with autoTrack: false; call enableTracking() from the CMP accept callback and disableTracking() on revoke/decline
EU/privacy signals but no CMPUse autoTrack: false and tell the user they need a consent decision; do not build a CMP unless asked
No consent requirement foundUse default autoTrack: true

Explain the tradeoff: autoTrack: true creates browser visitor storage immediately. autoTrack: false waits until enableTracking() is called.

If identity is known before consent, use the React user prop or setUser() so identity is queued and applied after tracking starts. Do not call browser identify() before tracking is enabled.

Decision 2: Identity

Use the strongest identifiers available:

  • email: primary person identifier.
  • userId: the app/auth-provider user or contact ID.
  • customerId: the app's account/workspace/customer/team ID.
  • customerTraits: account/workspace metadata such as plan or seats.
  • traits: user/contact metadata such as name or role.
  • fingerprint: stable device/install ID for native or non-browser tracking.

Recommendations:

ContextPattern
React/NextPass user={{ email, userId, customerId, traits, customerTraits }} to OutlitProvider once auth resolves
Vue/NuxtUse useOutlitUser(refOrComputedUser) or plugin setUser()
SPA without framework helpersCall setUser({ email, userId, customerId }) after auth, and clearUser() on logout
Script tagCall window.outlit.setUser(...) after auth, or identify(...) after tracking is enabled
Server NodeCall identify({ email, userId, customerId }) for user/profile updates; call track({ customerId, eventName }) for account-scoped events
Native/deviceTrack with a persistent fingerprint; later call identify({ email, fingerprint }) or Rust .fingerprint(...) to link history

Critical distinction: browser identify/setUser links anonymous visitor history. Server identify attributes server-side identity and can link fingerprints/customer IDs, but it does not link browser visitor cookies unless the browser also identifies.

Decision 3: Existing Analytics

DetectionRecommendation
Existing analytics wrapperAdd Outlit to the wrapper
Direct analytics calls scattered across filesCount them and ask whether to add Outlit alongside existing calls or introduce a wrapper
PostHog connected as data sourceDo not duplicate every PostHog event by default; use SDK for missing product/website/customer identity gaps
No analyticsAdd Outlit directly

Keep event names snake_case and avoid reorganizing unrelated analytics code.

Decision 4: Activation

Activation means a user reached the product's meaningful value moment. It is not automatically "completed onboarding" unless onboarding itself delivers value.

  1. Scan for first-value actions: first project/resource created, first integration connected, first report/export generated, first invite, first successful core workflow.
  2. Suggest the strongest candidate and ask for confirmation if ambiguous.
  3. Call user.activate() only after the action is confirmed complete, usually after the backend succeeds.
  4. Ensure the user is identified first. Browser SDK queues up to 10 activation events until identity is set, but the cleaner integration is to set identity before activation.
  5. Do not call user.engaged() or user.inactive() in new integrations.

Decision 5: Billing

Billing is account-level context, separate from contact journey stages.

DetectionRecommendation
Stripe connected in OutlitLet the Stripe integration handle trialing/paid/churned
Stripe in app but not connectedRecommend connecting Stripe in Outlit; only add manual SDK calls if they need custom logic
Other/custom billingAdd billing calls in existing webhook/job handlers
No billingSkip

TypeScript:

outlit.customer.paid({
  customerId: "cust_123",
  properties: { plan: "pro" },
})

Rust currently differs:

client.customer()
    .paid("acme.com")
    .customer_id("cust_123")
    .send()
    .await?;

Always flush server/native queues before the handler exits.

Decision 6: Event Tracking

Browser SDK defaults already capture:

  • pageviews, including SPA navigation
  • form submissions with sensitive fields removed
  • auto-identify from email/name form fields
  • engagement time and sessions
  • Cal.com/Calendly booking events, without attendee email/name from client-side embeds

Add custom track() calls only for meaningful product actions that are not covered by automatic capture or connected integrations. Use properties for useful context, not PII or secrets.

Calendar embed limitation: Cal.com and Calendly client events do not expose attendee email/name. Use provider webhooks plus server identify() when booked-meeting identity matters.

Hash-routed SPAs, file:// routes, and Electron-style hash paths are handled by the core path extractor; do not add custom path parsing unless the app has a special router.

Decision 7: Server and Native Tracking

Use server/native tracking for backend-confirmed product activity, billing, background jobs, native apps, CLIs, and device-based activity.

Node example:

import { Outlit } from "@outlit/node"

const outlit = new Outlit({ publicKey: process.env.OUTLIT_KEY! })

outlit.track({
  customerId: "cust_123",
  eventName: "workspace_synced",
  properties: { provider: "github" },
})

await outlit.flush()

Use fingerprint for native/desktop/mobile activity before login:

outlit.track({
  fingerprint: deviceId,
  eventName: "app_opened",
})

outlit.identify({
  email: user.email,
  fingerprint: deviceId,
})

Serverless rule: await outlit.flush() before returning. Long-lived process rule: reuse one client and call shutdown() on graceful shutdown.

Doc URL Map

Fetch docs as needed. Prefer docs over hardcoding long framework patterns, but apply the API guardrails above if examples conflict.

TopicURL
Quickstarthttps://docs.outlit.ai/tracking/quickstart
How tracking workshttps://docs.outlit.ai/tracking/how-it-works
Customer context graphhttps://docs.outlit.ai/concepts/customer-context-graph
Website visitorshttps://docs.outlit.ai/concepts/website-visitors
Identity resolutionhttps://docs.outlit.ai/concepts/identity-resolution
Customer journeyhttps://docs.outlit.ai/concepts/customer-journey
NPM/browser packagehttps://docs.outlit.ai/tracking/browser/npm
Reacthttps://docs.outlit.ai/tracking/browser/react
Next.jshttps://docs.outlit.ai/tracking/browser/nextjs
Vue 3https://docs.outlit.ai/tracking/browser/vue
Nuxthttps://docs.outlit.ai/tracking/browser/nuxt
SvelteKithttps://docs.outlit.ai/tracking/browser/sveltekit
Angularhttps://docs.outlit.ai/tracking/browser/angular
Astrohttps://docs.outlit.ai/tracking/browser/astro
Script taghttps://docs.outlit.ai/tracking/browser/script
Calendar embedshttps://docs.outlit.ai/tracking/browser/calendar-embeds
Node.jshttps://docs.outlit.ai/tracking/server/nodejs
Rust / Taurihttps://docs.outlit.ai/tracking/server/rust
Ingest APIhttps://docs.outlit.ai/api-reference/ingest
Full docs indexhttps://docs.outlit.ai/llms.txt

Troubleshooting

No browser events

  1. Confirm the public env var prefix is correct and exposed to the client bundle.
  2. Confirm provider/init runs once at app startup and wraps the app.
  3. If autoTrack: false, call enableTracking() after consent.
  4. Check Network for /api/i/v1/<publicKey>/events.
  5. Check console warnings such as tracking not enabled, already initialized, or multiple instances.

Events not linked to users

  • Prefer OutlitProvider user, useOutlitUser, or setUser() for auth state.
  • Send both email and userId when available.
  • Include customerId for account/workspace-scoped products.
  • Browser identity links visitor history; server identity does not replace browser identity.
  • For native/device history, reuse the same persistent fingerprint before and after login.

Server events missing

  • Use publicKey, not privateKey.
  • Use eventName, not event.
  • Provide at least one of email, userId, fingerprint, or customerId to track().
  • identify() needs email or userId.
  • Always await outlit.flush() before serverless handlers return.
  • Non-retryable ingest errors stop automatic retries until restart; fix credentials/config instead of waiting.

Activation missing or delayed

  • Call activation after identity is set.
  • In browsers, user.activate() can queue until setUser()/identify() provides identity, but the queue is bounded.
  • Do not use deprecated engaged/inactive calls; send product activity with track().

Key Principles

  • Minimal changes: instrument the existing app shape.
  • Detect first, ask second.
  • Use customerId for account/workspace context.
  • Use setUser/provider user for auth lifecycle.
  • Use track() for product activity; use user.activate() only for the activation milestone.
  • Flush server/native queues before exit.
  • Keep events snake_case.

Installation

Install this skill through the Outlit CLI when possible:

outlit setup skills

Or with the Skills CLI:

npx -y skills add https://github.com/OutlitAI/outlit-agent-skills --skill outlit-sdk -g

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

BigA

A股智能分析与选股工具。维护动态股票池(最多30支),按高科技×中小市值×好业绩原则筛选,推送买卖信号。含独立技术面择时分(-10~+10)用于判断买入卖出时机。

Registry SourceRecently Updated
General

AI Product Manager

OpenClaw-first AI product manager for turning analytics, revenue, crash, store, and feedback signals into execution-ready proposals and backlog work.

Registry SourceRecently Updated
General

OpenClaw Growth Engineer

OpenClaw-first growth autopilot for mobile apps. Correlate analytics, crashes, billing, feedback, store signals, and repo context into proposal drafts that c...

Registry SourceRecently Updated
General

Send Md As

在即时通讯 app 中以优雅图片形式展示 Markdown。支持标题、代码高亮(行号、Monokai)、LaTeX 公式、Mermaid 图表、表格、列表。4 种色彩主题,智能分页。渲染阶段零 CDN 依赖(安装时需网络下载依赖)。| Render Markdown as a polished image for...

Registry SourceRecently Updated