Getting started

This guide describes the steps you need to follow to add Ninetailed to React JS.

With the React SDK you can add dynamic content for personalization to any component.

Install React SDK

Install the @ninetailed/client-sdk-react module via npm or yarn.

Install module via npm

npm install @ninetailed/client-sdk-react

Install module via yarn

yarn add @ninetailed/client-sdk-react

How to use

This is what the configuration of @ninetailed/client-sdk-react looks like:

import React from 'react';
import {
ProfileProvider,
AnalyticsProvider,
} from '@ninetailed/client-sdk-react';
export const App = () => {
return (<>
<ProfileProvider>
<AnalyticsProvider apiKey="Your_API_Key">
<YourAppCode />
</AnalyticsProvider>
</ProfileProvider>
</>);
}

Your API Key can be found in the CMS or Ninetailed dashboard configuration.

Contentful app configuration screen

Next you need to set the ProfileProvider and AnalyticsProvider. We recommend to simply wrap your app component with both providers.