Settings Install (THEME (light))
Per-project install snippet

SDK install

@trueclara/next is the runtime SDK. It records cookieless aggregate pageviews by default, records session-scoped evidence after analytics opt-in, attaches the active deploy id, and forwards events to the ingestion endpoint. It does not write cookies or localStorage.

Install

Terminal
npm install @trueclara/next

The fastest path is to run the codemod, which writes the provider, environment variables, and a first static graph upload for you.

Terminal
npx @trueclara/install

Manual setup

Wrap the app in TrueClaraProvider and read consent state through useTrueClara.

TSX
import { TrueClaraProvider, useTrueClara } from "@trueclara/next";

export default function RootLayout({ children }: { children: React.ReactNode }) {
  return (
    <TrueClaraProvider publicKey={process.env.NEXT_PUBLIC_TRUECLARA_KEY!}>
      {children}
    </TrueClaraProvider>
  );
}

function ConsentToggle() {
  const { setConsent, getConsent } = useTrueClara();
  const consent = getConsent();
  return (
    <button onClick={() => setConsent({ analytics: consent !== "analytics" })}>
      {consent === "analytics" ? "Disable analytics" : "Enable analytics"}
    </button>
  );
}

What flows after install

  • Aggregate route traffic in cookieless mode by default.
  • Session-scoped behavioral events when consent is analytics.
  • The active deploy id, so observations attach to the commit that produced them.