Ninetailed
Search…
⌃K

Getting Started

This guide describes the steps you need to follow to add Ninetailed to Next.js.
With the Next.js SDK, you can add dynamic content for personalization to any component.

Install Next.js SDK

Install the @ninetailed/experience.js-next module via npm or yarn.

Install module via npm

npm install @ninetailed/experience.js-next

Install module via yarn

yarn add @ninetailed/experience.js-next

How to Use

This is what the basic configuration of @ninetailed/experience.js-next looks like:
// pages/_app.tsx
import React from 'react';
import { AppProps } from 'next/app';
import {
NinetailedProvider
} from '@ninetailed/experience.js-next';
export const App: React.FC<AppProps> = ({ Component, pageProps }) => {
return (
<NinetailedProvide
clientId="YOUR_API_KEY"
/* An array of all experiments from your CMS */
experiments={pageProps.ninetailed?.experiments || []}
>
<Component {...pageProps} />
</NinetailedProvider>
);
}
The <NinetailedProvider /> supports the same properties as the one exported by the @ninetailed/experience.js-react SDK. You can find the documentation in the React section.