Next.js
A complete guide to integrate the InBe widget for Next.js websites.
This guide will help you add the InBe widget to your Next.js website using the Script component.
Method 1: Using Next.js Script Component (Recommended)
Add the widget container
- In your Next.js component, add a container element where you want the widget to appear:
Add the widget scripts
- Import the Script component from Next.js:
- Add both scripts to your component:
Method 2: Using useEffect Hook
Create a widget component
Use the component in your page
Method 3: Using _document.js
Add scripts to _document.js
Add the container to your page
Important Notes
Make sure to replace YOUR_PUBLIC_API_KEY with your actual API key
Troubleshooting
If the widget doesn't appear: 1. Ensure the container element exists on the page 2. Check that your API key is correct 3. Try refreshing the page 4. Make sure both scripts are properly loaded 5. Check the browser console for any errors