Quickstart (Pages Directory)
Integrate c15t into your Next.js pages directory application with this step-by-step guide. We'll cover installation, configuration, and basic usage.
CLI Setup (Recommended)
You can get started with the @c15t/cli which will generate the code for you!
Manual Setup
Install @c15t/nextjs Package
Next.js Rewrites (Optional)
Info
You can use Next.js Rewrites to redirect requests to the c15t backend. This is useful if you want to hide the c15t backend url from your users. Learn more about Next.js Rewrites.
Adding it to your Next Application
In every page you want to pre-fetch the data server-side, you can use the withInitialC15TData helper. Otherwise, it will be fetched client-side.
Info
If you're using Next.js Rewrites, you can use the backendURL option to redirect requests to the c15t backend by setting it to /api/c15t.
Storing Consent
We recommend using the hosted solution with consent.io to store your consent.