Next.js Installation
For Next.js, use the Script component from the next/script package. This allows loading the widget asynchronously without affecting performance.
Add Code to Layout
Add the following code to your root `layout.tsx` (App Router) or `_app.tsx` (Pages Router):import Script from 'next/script'
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
{children}
{/* Parsewise Widget */}
<Script
id="parsewise-config"
strategy="afterInteractive"
dangerouslySetInnerHTML={{
__html: `window.ParsewiseConfig = { shopId: "YOUR_SHOP_ID" };`
}}
/>
<Script
src="https://releases.parsewise.ru/widget/latest/widget.iife.js"
strategy="afterInteractive"
/>
</body>
</html>
)
}
Strategy Parameters
afterInteractive— loads after hydration (recommended)lazyOnload— loads after full page load