Documentation · Prynt Reveal · Install

Next.js / React

Mount Reveal once on the client; route changes are followed automatically. Works with the App Router, the Pages Router and plain React Router apps.

npm package (recommended)

npm install @pryntid/js
// app/prynt-reveal.tsx — a client component mounted once in app/layout.tsx
'use client';
import { useEffect } from 'react';
import { reveal } from '@pryntid/js/reveal';

export default function PryntReveal() {
  useEffect(() => {
    // spa: true (default) patches history.pushState, so App Router / Pages Router navigations
    // become pageviews on their own. stop() removes every listener on unmount.
    const client = reveal({ publicKey: process.env.NEXT_PUBLIC_PRYNT_KEY!, website: 'example.com' });
    return () => client.stop();
  }, []);
  return null;
}

// app/layout.tsx
// import PryntReveal from './prynt-reveal';
// <body>{children}<PryntReveal /></body>

Plain React (Vite, CRA, React Router): the same useEffect in your root component. Hash routers (#/path) are not detected — call reveal.pageview() from your router's listener.

Alternative: next/script with the CDN build

// Pages Router or no npm: next/script with the CDN build (loads after hydration)
import Script from 'next/script';

<Script src="https://api.pryntid.com/cdn/prynt-reveal.umd.js" strategy="afterInteractive"
  onLoad={() => window.PryntReveal.reveal({ publicKey: 'pk_live_YOUR_PUBLIC_KEY', website: 'example.com' })} />

Notes

  • Server components and SSR: PryntReveal.reveal() returns a no-op client when window is missing, but keep the call in a client component anyway so it does not run on every render.
  • React Strict Mode mounts effects twice in development; the cleanup (reveal.stop()) handles it.
  • Content-Security-Policy with nonces (next.config headers or middleware): the npm route needs no inline script. With next/script, pass nonce.
  • Identify after login: reveal.identify({ email: session.user.email }) in the component that knows the session.

Run the Test Script

  1. In the console go to Websites → your site → **Test Script**. It fetches your page from our side and runs the seven checks: snippet present, public key, website match, CSP script-src, CSP connect-src, consent manager, script position and www redirect.
  2. Open your site with ?prynt_debug=1 to see the live panel from the browser's point of view (consent, CMP, storage, cspBlocked, last send).
  3. Visit two or three pages. The pulse in the console shows the last event within seconds; the first companies appear as soon as a business network visits.

A cspBlocked: true or a failed CSP check means your Content-Security-Policy needs the two lines from CSP and storage. Running a consent manager? Consent explains what is detected and what is sent before the visitor decides.

Next: Nuxt / Vue

Last updated 2026-11-03 · Limits · Visitor opt-out