Skip to main content

Overview

Core figures out two things on every visit: which project the request belongs to, and who the visitor is — an anonymous app user ID it creates the first time someone visits (no login or account needed) and remembers across sessions. Every other SDK reuses that identity from Core, so it’s only set up once. Core doesn’t make any network calls of its own, and it’s required by every other SDK on this site.

Implementation

Install

Project config

Generate your project config with the Embeddables CLI, then import the generated output in your app:
The generated config does not include your publishableKey — always add it when initializing ({ ...config, publishableKey }). Use the key em init printed, or find it under Settings → Portal / SDK in the admin app. Install once, then pick your setup:
In your existing React app (React 18 or newer), wrap it once, above every product SDK:
The modules import in the example turns on Analytics, Experiments, and Forms when you use those products. If you only need Core for now, you can omit modules and add it later. Every Core hook is listed under Hooks reference below.
Core finishes setting up after your component mounts, so useEmbeddables() and useAppUserId() return null on the first render (and during server rendering). Always handle that loading state.
config, modules, and serverAppUserId only take effect on the first render — the provider captures them once and does not pick up changes on later renders. To switch project, product modules, or visitor identity later, remount EmbeddablesProvider (for example, with a key).

Turning on other SDKs (React)

Recommended: run em build after you add SDKs with the CLI. It creates the modules file you import in the example — already in the right order.Manual: list each product’s React setup yourself (same as the generated file). Put Analytics first so Experiments and Forms can use it. Form schemas live in Core config (config.forms from the CLI), so forms() takes no schema argument:
Include only the factories for the SDKs you use. Each factory takes that SDK’s options — for example analytics({ publishableKey }) or forms({ analyticsInstance }).

Hooks reference

Core’s React hooks only work inside the wrapper from the example. They may show empty at first while Core finishes loading — handle that brief state in your UI. See the reference for useEmbeddables, useAppUserId, page views, and the rest.
Need every method and hook? See Reference — methods and hooks.

Do I ever call Core directly?

Usually not much beyond initializing it. Its getters are mostly used by Analytics, Experiments, and Forms behind the scenes — you’ll work with those SDKs far more often than with Core itself. The full instance and config surface is catalogued in the Reference.