Add the widget to your framework
Where the script tag goes in plain HTML, Astro, Next.js and site builders.
In every case, the goal is the same: load the snippet once, on every page. Replace YOUR_SITE_ID with the ID from your snippet.
Plain HTML
Paste the snippet before </body> on each page, or in the shared footer include if your site has one.
<script src="https://app.talktomysites.com/widget.js" data-site-id="YOUR_SITE_ID" defer></script>
</body>Astro
Add the snippet to your base layout, before </body>. Use is:inline so Astro leaves the tag as it is instead of bundling it.
<body>
<slot />
<script is:inline src="https://app.talktomysites.com/widget.js" data-site-id="YOUR_SITE_ID" defer></script>
</body>Next.js
Add the script to your root layout with next/script. The layout stays mounted between page changes, so the widget loads once.
// app/layout.tsx
import Script from "next/script";
export default function RootLayout({ children }: { children: React.ReactNode }) {
return (
<html lang="en">
<body>
{children}
<Script
src="https://app.talktomysites.com/widget.js"
data-site-id="YOUR_SITE_ID"
strategy="afterInteractive"
/>
</body>
</html>
);
}Site builders and CMSs
Most site builders have a setting for custom code in the site footer, or for code added before </body> on every page. Paste the snippet there and publish. If the setting only applies to one page, look for a site-wide version instead.