@trueclara/next
v0.1.0
Published
Cookieless TrueClara runtime SDK for Next.js.
Maintainers
Readme
@trueclara/next
Cookieless runtime SDK for TrueClara — behavioral observability for Next.js apps.
This is one of the two packages that run inside your app (alongside @trueclara/parser). It posts aggregate, cookieless route and edge counters to the TrueClara ingestion endpoint. The dashboard, ingestion, billing, and regression detector are operated as a managed service.
Install
npm install @trueclara/nextMost teams add it automatically with npx @trueclara/install, which wires up the provider and writes your key.
Usage
Wrap your app in TrueClaraProvider:
import { TrueClaraProvider } from "@trueclara/next";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html>
<body>
<TrueClaraProvider
publicKey={process.env.NEXT_PUBLIC_TRUECLARA_KEY!}
consent="aggregate"
>
{children}
</TrueClaraProvider>
</body>
</html>
);
}The public runtime API is TrueClaraProvider plus the useTrueClara() hook.
Consent
consent defaults to aggregate, which sends cookieless route and edge counters. For strict no-network-until-consent mode, pass consent="none" and opt in after your banner records analytics consent:
const { setConsent } = useTrueClara();
setConsent({ analytics: true });Docs
- SDK reference: https://trueclara.com/docs/reference/sdk
- Source: https://github.com/trueclara/trueclara-js
License
Apache-2.0
