Integrate Botuj Chatbot in Next.js
Learn how to embed the Botuj chatbot in a Next.js application.
To add the Botuj chatbot to your Next.js app, follow these steps:
📥 Step 1: Get Your Embed Script
In your Botuj dashboard:
- Go to Settings → Embed
 - Copy the script:
 
<script
  defer
  src="https://cdn.botuj.pl/loader.js"
  data-key="${chatbotId}"
></script>
Replace ${chatbotId} with your actual chatbot ID.
🧩 Step 2: Add to _document.js
In a Next.js project, place the script in your custom _document.js:
// pages/_document.js
import { Html, Head, Main, NextScript } from 'next/document'
export default function Document() {
  return (
    <Html>
      <Head />
      <body>
        <Main />
        <NextScript />
        <script
          defer
          src="https://cdn.botuj.pl/loader.js"
          data-key="YOUR_CHATBOT_ID"
        ></script>
      </body>
    </Html>
  )
}
✅ Done! The chatbot will now appear on all pages of your Next.js app.