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 the
@ninetailed/experience.js-next
module via npm or yarn.npm install @ninetailed/experience.js-next
yarn add @ninetailed/experience.js-next
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.Last modified 3mo ago