Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.insito.app/llms.txt

Use this file to discover all available pages before exploring further.

MicroSurvey.init(config) takes a single InsitoConfig object. Most apps need just apiKey — every other field is optional with a sane default.

Full schema

interface InsitoConfig {
  apiKey: string;                     // Required
  apiUrl?: string;                    // default: https://api.insito.app
  requestTimeoutMs?: number;          // default: 5000
  debug?: boolean;                    // default: false
  theme?: {
    preset?: "light" | "dark" | "minimal" | "rounded";
    overrides?: Partial<InsitoTheme>;
  };
}

apiKey (required)

Your project secret. Format proj_xxx. Get it from the dashboard → your project → Settings → API key.
The API key is a secret. Don’t commit it to a public repo. For local development, drop it in .env and import via expo-constants or react-native-config.
import Constants from "expo-constants";

MicroSurvey.init({
  apiKey: Constants.expoConfig.extra.insitoApiKey,
});

apiUrl

Defaults to https://api.insito.app. Override when:
  • Pointing the SDK at a staging environment.
  • Running against a local API instance during development.
MicroSurvey.init({
  apiKey: "proj_xxx",
  apiUrl: __DEV__ ? "http://localhost:3001" : undefined,
});
Local dev with iOS Simulator: use the host machine’s LAN IP (http://192.168.x.x:3001), not localhost. The simulator treats localhost as itself.

requestTimeoutMs

How long the SDK waits for any one request before giving up. Defaults to 5,000 ms (5 seconds). Lower this if your users are on consistently fast networks and you want triggers to fail fast. Raise it if you have a lot of users on weak cellular — too-tight timeouts increase the offline-queue backlog.

debug

Enables console.log output for SDK internals — init, identify, trigger, queue flushes, screen-map flushes, plus error details. Recommended:
MicroSurvey.init({
  apiKey: "proj_xxx",
  debug: __DEV__,
});
Off by default so production builds stay quiet.

theme

Pick a preset, override individual tokens, or both. See Theming for the full token list.
MicroSurvey.init({
  apiKey: "proj_xxx",
  theme: {
    preset: "rounded",
    overrides: {
      colors: {
        primary: "#FF6B35",
      },
    },
  },
});

Updating config after init

init() is a one-shot — repeat calls are ignored. To change configuration mid-session (e.g. switch theme), use the <InsitoProvider theme={...}> prop:
<InsitoProvider theme={{ preset: darkMode ? "dark" : "light" }}>
  <App />
</InsitoProvider>
The provider’s theme prop wins over the SDK-level config.