How It Works

An overview of the overarching Javascript SDK.
Ninetailed SDKs provide abstracted means to communicate with the Ninetailed Experience API and the browser. It shortens integration times into JavaScript codebases. The SDKs handle:
  • Creating page, track, & identify events and send them to Ninetailed API
  • Taking care of Errors, Retries & Queuing
  • Handling Client-Side Cache

JavaScript-Based SDKs

All JavaScript Ninetailed Experience SDKs inherit from a base JavaScript SDK, @ninetailed/experience.js. Currently, SDKs for React, Next.js, and Gatsby are available.
If you are using a JavaScript web framework which is not supported yet, you can always fall back to that library. However, we strongly recommend using the SDK available for your framework if one is available.

How to Use The JavaScript SDK

To work with the base JavaScript SDK, install the module:
npm install @ninetailed/experience.js
# OR
yarn add @ninetailed/experience.js
Then, create a new instance of the Ninetailed class.
When working with the React, Gatsby, and Next.js Ninetailed SDKs, you do not need to manually make a new Ninetailed instance as in the code example below. Installing those SDKs automatically create the Ninetailed instance and make it available globally within the application.
import { Ninetailed } from '@ninetailed/experience.js';
const ninetailed = new Ninetailed(
// Your Ninetailed API Key - required
clientId: "...",
// Set this if you want to use another env as main. Defaults to main.
environment: "main",
// Defaults to false - set if you want to see Draft Audiences.
preview: false
// Use the Ninetailed Plugin system, e.g. privacy, preview Widget etc.
plugins: [],
// Passes a profile for SSR
profile: undefined,
// Translates Ninetailed provided Data like location into given locale
locale: "en-US",
// The maximum loading time until the fallback (Baseline) will be shown
requestTimeout: 500
// send a pageview;
// send a track event
// send a identify event
ninetailed.identify('userId', { firstname: "Louis" })
Your frontend is not Javascript-based? Have a look at our Experience API for complete freedom of integration. For more information, contact us.