Introduction

Explore the structure and composition of Ninetailed SDK and choose the correct dependency for your personalization & experimentation project.

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 sending them to the Experience API

  • errors, retries and queuing

  • caching the profile client-side via localStorage

Composed JavaScript SDKs

Ninetailed's lowest-level SDK is the Shared SDK, @ninetailed/experience.js-shared whose primary function is to create a API Client that handles the details of working with the endpoints of the Experience API. It also exposes data objects, types, and methods applicable across development environments

Ninetailed's JavaScript SDK, @ninetailed/experience.js, is composed from the Shared SDK. The principal function of the JavaScript SDK is to create a Ninetailed instance that stores and updates a profile in response to events.The JavaScript and Shared SDK form the foundations on top of which all other Ninetailed JavaScript-based SDKs are built.

For declarative front-end implementations, Ninetailed provides SDKs for React, Next.js, and Gatsby. Additionally, Ninetailed provides a Node.js SDK for interacting with the Experience API in server or edge runtimes.

Choosing an SDK

We strongly recommend using the SDK available for your framework if one is available for the fastest, most declarative implemenation. For most Ninetailed users, installing the appropriate React-based SDK, sending page, track, and identify events to enhance user profiles, and using the <Experience> component to render personalization and experiment content client-side will be sufficient.

However, you may need to arbitrarily access profile data or exercise more control over how experiences are rendered and tracked. These needs usually arise when:

  1. you need more control within a React-based web application, like if you're edge- or server-side rendering experiences and/or using React Server Components; or

  2. you're not implementing Ninetailed within a web-based React project (e.g., Vue/Nuxt, Svelte or React Native).

In such scenarios, the API Client created by the Shared SDK serves as the best starting place for upserting profiles in server and edge runtimes, while the JavaScript SDK is provides declarative tracking behaviour to use in client-side code.

Is your frontend is not JavaScript-based? Have a look at our Experience API for complete freedom of integration. For more information, contact us.

Last updated