Quick start: Web (TypeScript)
Install the TypeScript SDK, set consent, identify pseudonymously, track events and read remote config.
The web SDK (@aop/sdk-js, working package name) is dependency-free, buffers events offline in localStorage, retries with exponential backoff and never throws into your app. Until registry publishing is set up, build it from sdks/javascript in the repository (npm install && npm run build) and install the folder or tarball.
1. Create a project and copy the publishable key
In the dashboard, create a project (app or game). You receive a publishable key (pk_…, safe in client code) and a secret key (sk_…, server only — shown once).
2. Initialise
import { init, Events } from "@aop/sdk-js";
export const aop = init({
projectKey: "pk_…",
endpoint: "https://api.your-domain.com", // your API base URL
appVersion: "1.4.2",
onError: (err, ctx) => console.debug("[aop]", ctx, err),
});3. Consent and identity
Consent defaults to opt-in (everything false). Events are dropped client-side — and again server-side — without analytics consent. Identify users with a pseudonymous ID only; the SDK rejects values that look like email addresses.
await aop.setConsent({ analytics: true, personalization: true, marketing: false });
await aop.identify("u_8f3a91"); // your internal, non-personal ID4. Track
aop.track(Events.SCREEN_VIEWED, { screen: "home" });
aop.track("feature_used", { feature: "export" });
aop.trackRevenue(4.99, "USD", { sku: "starter_pack" }); // purchase_completed
aop.trackSubscription("started", "pro_monthly", 7.99, "USD");
await aop.setUserProperties({ plan_tier: "free" }); // no PIISessions are tracked automatically (session_started / session_ended after 30 minutes of inactivity).
5. Remote config, experiments and experiences
await aop.fetchConfig();
const steps = aop.getParam("onboarding_steps", 4); // records $exposure if under test
if (aop.isEnabled("new_dashboard")) { /* … */ }
const hero = aop.getExperience("home.hero"); // Engine C content or null
const offers = aop.getActions("offer");6. Verify the integration
Open your project in the dashboard — the integration status switches to receiving once events arrive, and the latest events are listed under Integration.