Skip to main content
Installation
Language

Next.js Integration

Integrate cside with your Next.js application using the @cside.dev/next package and adding the CSideScript component to your root layout.

Installation

Install the cside Next.js package:

npm i @cside.dev/next

Setup

Add the CSideScript component with your team ID. You find the team ID under Team Settings > General in the cside dashboard.

Always pass teamId

Without teamId, the component loads the shared https://proxy.csidetm.com/script.js host instead of your team-scoped host. Pass teamId so traffic is attributed to your team.

Add the CSideScript component to your root layout:

// app/layout.tsx
import { CSideScript } from "@cside.dev/next";

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <CSideScript teamId="[your-team-id]" />
        {children}
      </body>
    </html>
  );
}

Add the CSideScript component to your custom document:

// pages/_document.tsx
import Document, { Html, Head, Main, NextScript } from "next/document";
import { CSideScript } from "@cside.dev/next";

export default function MyDocument() {
  return (
    <Html lang="en">
      <Head>
        <CSideScript teamId="[your-team-id]" />
      </Head>
      <body>
        <Main />
        <NextScript />
      </body>
    </Html>
  );
}

Props

CSideScript renders a <script> tag with referrerpolicy="origin" and accepts these props:

PropTypeDefaultDescription
teamIdstringnoneYour cside team ID. Loads the script from https://{teamId}.csidetm.com/script.js (or csidefd.com when fingerprint is true). Without it the shared proxy host is used
fingerprintbooleanfalseLoad the Device Intelligence script from csidefd.com instead of the monitoring script. Combine with teamId for a team-scoped Device Intelligence host. The next release renames this prop to deviceIntelligence; fingerprint stays supported as an alias
scriptURLOverridestringnoneLoad the script from a custom URL. Ignored when teamId is set
optionsobjectnoneDeprecated and ignored. Script settings are managed in the dashboard

Any other prop is passed through to the underlying <script> element.

<CSideScript teamId="[your-team-id]" fingerprint />
Was this page helpful?