Provedly runs in a Next.js app with one script tag, loaded once from your root layout. The widget renders inside a Shadow DOM, so it does not touch your Tailwind or CSS Modules, and the loader is idempotent across client-side route changes. The only Next-specific work is deciding where to put the tag and, if you want attribution, forwarding the visitor id to your checkout.
The one-line install
Create a widget in the dashboard, copy the token, and add the script to your root layout. With the App Router, next/script is the clean way to do it.
// app/layout.tsx
import Script from 'next/script';
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
{children}
<Script
src="https://provedly.app/w/widget.js"
data-token="pp_your_token"
strategy="afterInteractive"
/>
</body>
</html>
);
}
afterInteractive loads the script after hydration, which is the right trade-off for a non-critical element. Do not use beforeInteractive; nothing about a purchase toast needs to block the page. The bundle is about 6 KB gzipped and the loader fetches the widget config from GET /api/w/{token}/config, which returns settings and up to 30 recent records.
If you still use the Pages Router, put the same <Script> in pages/_app.tsx. The behaviour is identical.
Route changes and the SPA problem
Toasts are governed by per-session caps: by default a 3-second start delay, 6 seconds on screen, a 30-second gap, and at most 5 notifications per session. Those caps are tracked by the widget, not by the page, so a visitor who clicks through five product pages does not get five fresh cycles. That is intentional. A notification that fires again on every navigation is the fastest way to be dismissed as spam.
The loader checks for an existing instance before it initialises, so even if your layout remounts the script tag it will not double-render. If you prefer to mount it from a client component, the documented pattern looks like this:
'use client';
import { useEffect } from 'react';
export function ProofWidget() {
useEffect(() => {
if (document.querySelector('script[data-token="pp_your_token"]'))
return;
const s = document.createElement('script');
s.src = 'https://provedly.app/w/widget.js';
s.dataset.token = 'pp_your_token';
s.async = true;
document.body.appendChild(s);
}, []);
return null;
}
Render <ProofWidget /> once, in the root layout. URL targeting (all pages, only these, all except) is configured in the dashboard, so you do not need conditional rendering in React to keep the widget off, say, /account.
Styling: what you do and do not control
Because the widget lives in a Shadow DOM, your global CSS cannot reach it and its CSS cannot reach you. That rules out the usual class-name collisions and z-index surprises. You choose the look in the dashboard instead: one of five themes (Clean white, Deep ocean, Midnight, Electric violet, Sunset blaze), the name format, the location format and the position. Read Shadow DOM: why the widget cannot break your CSS if you want the details.
If you run a strict Content Security Policy, allow https://provedly.app for script-src and connect-src. The widget makes requests to the config, track and presence endpoints on that origin and nowhere else.