Add Social Intents to any site deployed on Vercel - Next.js, React, static HTML, or any other framework.
Static or Server-Rendered Sites
Add the Social Intents script tag to your HTML. The exact location depends on your framework:
Next.js (App Router)
Add a Script component to your root layout:
// app/layout.tsx
import Script from "next/script";
export default function RootLayout({ children }) {
return (
<html>
<body>
{children}
<Script
src="https://www.socialintents.com/api/chat/socialintents.1.4.js#YOUR_WIDGET_ID"
strategy="lazyOnload"
/>
</body>
</html>
);
}
Next.js (Pages Router)
Add it to _document.js or _app.js using the next/script component with strategy="lazyOnload".
React (Create React App or Vite)
Add the script tag to public/index.html before the closing </body> tag:
<script src="https://www.socialintents.com/api/chat/socialintents.1.4.js#YOUR_WIDGET_ID" async="async"></script>
Static HTML
Add the script tag directly to your HTML files before </body>.
Vercel Environment Variables
To keep your widget ID configurable across environments, store it as a Vercel environment variable and reference it in your code. This is optional - the widget ID is not sensitive and can be included directly in your code.