next/script component in your root layout, so it loads on every page. next/script passes data-* props through to the tag.
Before you start
- Your website widget. Kelu makes one for you when you create a knowledge base. Its Install tab shows these steps with your widget id and key already in the code.
- Your app on the widget’s Sites it works on list (Install tab).
Add the widget
Open app/layout.tsx
This is the root layout that wraps every page (
app/layout.jsx works the same way).Add the Script component
app/layout.tsx
YOUR_WIDGET_ID and kl_pk_... with the values from your widget’s snippet.<Script> after <Component {...pageProps} /> in pages/_app.tsx, with both inside a fragment (<>…</>).