Prodinfos TypeScript SDK
Use This Skill When
-
adding Prodinfos analytics to a JS or TS app
-
instrumenting onboarding, paywall, purchase, or survey events
-
upgrading within the current @prodinfos/sdk-ts line
-
validating SDK behavior together with @prodinfos/cli
Supported Versions
-
Skill pack: 1.1.0
-
Target package: @prodinfos/sdk-ts
-
Supported range: >=0.1.0-preview.0 <0.2.0
-
If a future SDK major changes APIs or event contracts in incompatible ways, add a sibling skill such as prodinfos-ts-sdk-v1
See Versioning Notes.
Core Rules
-
Initialize exactly once near app bootstrap.
-
runtimeEnv is auto-attached. Do not pass a mode string.
-
debug is only a boolean for SDK console logging.
-
Do not pass endpoint and do not add endpoint env vars in app templates. Use the SDK default collector endpoint.
-
Prefer SDK constants and tracker helpers over ad-hoc event names.
-
Keep event properties stable and query-relevant.
-
Avoid direct PII.
-
Use storage when you need stable anonId and sessionId across restarts.
-
If a legacy analytics provider already exists, migrate it to Prodinfos as the primary provider instead of running permanent dual tracking.
-
For generated docs or README snippets, write from tenant developer perspective (your app , your workspace ) and avoid provider-centric phrasing such as our SaaS .
Minimal Web Setup
import { init } from '@prodinfos/sdk-ts';
const analytics = init({ apiKey: process.env.PRODINFOS_WRITE_KEY!, projectId: process.env.PRODINFOS_PROJECT_ID!, debug: false, platform: 'web', appVersion: '1.0.0', dedupeOnboardingStepViewsPerSession: true, });
React Native Setup
import AsyncStorage from '@react-native-async-storage/async-storage'; import { initAsync } from '@prodinfos/sdk-ts';
const analytics = await initAsync({ apiKey: process.env.PRODINFOS_WRITE_KEY!, projectId: process.env.PRODINFOS_PROJECT_ID!, debug: typeof DEV === 'boolean' ? DEV : false, platform: 'react-native', appVersion: '1.0.0', dedupeOnboardingStepViewsPerSession: true, storage: { getItem: (key) => AsyncStorage.getItem(key), setItem: (key, value) => AsyncStorage.setItem(key, value), removeItem: (key) => AsyncStorage.removeItem(key), }, });
Integration Depth Checklist
The integration should cover more than SDK bootstrap:
-
onboarding flow boundaries and step progression
-
paywall exposure, skip, purchase start, success, fail, cancel
-
screen views for core routes/screens
-
key product actions tied to user value (for example: first calibration complete, first result generated, export/share, restore purchases)
-
stable context properties (appVersion , platform , source , flow identifiers)
Instrumentation Rules
-
Use createOnboardingTracker(...) for onboarding flows.
-
Use trackPaywallEvent(...) for paywall and purchase milestones.
-
Use canonical event names from ONBOARDING_EVENTS , PAYWALL_EVENTS , and PURCHASE_EVENTS .
-
Keep onboardingFlowId , onboardingFlowVersion , paywallId , source , and appVersion stable.
Legacy Provider Migration Rule
When existing analytics code is present (for example Aptabase, Firebase Analytics, Segment):
-
Replace the old provider as the default event sink with Prodinfos.
-
Keep existing app-level tracking function signatures (trackEvent , trackScreenView , etc.) to minimize call-site churn.
-
Preserve legacy event names short-term only if dashboards depend on them, then normalize to canonical names.
-
Use temporary dual-write only during a defined migration window and remove it after validation.
Validation Loop
After integration or upgrade, verify ingestion with stable CLI checks:
prodinfos schema events --project <projectId> prodinfos goal-completion --project <projectId> --start onboarding:start --complete onboarding:complete --last 30d prodinfos get onboarding-journey --project <projectId> --last 30d --format text
References
-
Onboarding And Paywall Contract
-
Storage Options
-
Versioning Notes