Copy your own snippet
Use the exact code generated in your Instro dashboard so the right widget URL and user ID are preserved.
We use cookies to improve your experience. By using our site, you agree to our use of cookies. Learn more.
Installation Guide
Generate your widget in the dashboard, copy your Instro snippet, and then place it using the pattern that matches your stack.
Universal snippet
The safest option is to copy your generated snippet exactly as Instro gives it to you. The example below shows the general shape and placement only.
<script
src="YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js"
data-user-id="YOUR_INSTRO_USER_ID"
defer
><\/script>Install it once, publish your site, and then test on a live page.
Rules
Use the exact code generated in your Instro dashboard so the right widget URL and user ID are preserved.
Install the widget a single time in your global layout, footer, or root app file so it does not duplicate across pages.
For framework apps, load third-party scripts after the app mounts or with the framework's official script helper.
After deployment, open a real page, confirm the launcher appears, and send one test message from the live site.
Platforms
HTML
For plain HTML or simple server-rendered pages, paste the Instro snippet just before the closing body tag.
<!-- Paste your Instro dashboard snippet just before </body> -->
<script
src="YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js"
data-user-id="YOUR_INSTRO_USER_ID"
defer
><\/script>
</body>Using `defer` keeps the script from blocking the initial HTML parse in standard websites.
React
For React apps, add the widget once at the root and inject the script inside an effect so it only runs in the browser.
import { useEffect } from "react";
function InstroWidget() {
useEffect(() => {
if (document.getElementById("instro-web-assist")) return;
const script = document.createElement("script");
script.id = "instro-web-assist";
script.src = "YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js";
script.defer = true;
script.setAttribute("data-user-id", "YOUR_INSTRO_USER_ID");
document.body.appendChild(script);
return () => {
script.remove();
};
}, []);
return null;
}
export default function App() {
return (
<>
{/* your app */}
<InstroWidget />
</>
);
}This follows React's effect model for connecting to external systems on the client.
Next.js
For Next.js, use the framework's built-in `next/script` component and load the widget once from your top-level layout.
import Script from "next/script";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en">
<body>
{children}
<Script
id="instro-web-assist"
src="YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js"
data-user-id="YOUR_INSTRO_USER_ID"
strategy="lazyOnload"
/>
</body>
</html>
);
}This assumes “XJS” meant Next.js. If you meant a different stack, I can add that variant too.
Vue
For Vue, load the widget after mount so the DOM exists and the script only runs on the client.
<script setup>
import { onMounted, onUnmounted } from "vue";
let scriptEl;
onMounted(() => {
const existing = document.getElementById("instro-web-assist");
if (existing) return;
scriptEl = document.createElement("script");
scriptEl.id = "instro-web-assist";
scriptEl.src = "YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js";
scriptEl.defer = true;
scriptEl.setAttribute("data-user-id", "YOUR_INSTRO_USER_ID");
document.body.appendChild(scriptEl);
});
onUnmounted(() => {
scriptEl?.remove();
});
<\/script>
<template>
<RouterView />
</template>Vue's `onMounted()` hook is intended for DOM-related side effects and does not run during SSR.
Nuxt
For Nuxt, register the external script with `useHead()` and place it at the end of the body so it loads globally.
<script setup lang="ts">
useHead({
script: [
{
key: "instro-web-assist",
src: "YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js",
defer: true,
tagPosition: "bodyClose",
"data-user-id": "YOUR_INSTRO_USER_ID",
},
],
});
<\/script>
<template>
<NuxtPage />
</template>This assumes "Mug" meant Nuxt. Nuxt's head management supports body-close scripts directly.
WordPress
For WordPress, the quickest path is a Custom HTML block on the page you want. For a site-wide install, place the snippet in your footer template or code injection area.
<!-- Custom HTML block or footer.php -->
<script
src="YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js"
data-user-id="YOUR_INSTRO_USER_ID"
defer
><\/script>On WordPress.com, script tags require hosting-enabled plans. On WordPress.org or self-hosted installs, the user adding the block may need permission to use unfiltered HTML.
Wix
For Wix, add the Instro snippet through the platform's Custom Code settings so it loads globally without editing raw template files.
<!-- Wix dashboard > Settings > Custom Code -->
<script
src="YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js"
data-user-id="YOUR_INSTRO_USER_ID"
defer
><\/script>Wix's recommended placement options are Head, Body - start, or Body - end. For a chat widget, Body - end is the safest default.
Shopify
For Shopify, edit the theme code and place the widget in `theme.liquid` before the closing body tag so it loads across the storefront.
{%- comment -%} Paste before </body> in layout/theme.liquid {%- endcomment -%}
<script
src="YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js"
data-user-id="YOUR_INSTRO_USER_ID"
defer
><\/script>
</body>Duplicate your theme before editing code so you have a rollback point if you need one.
PHP
For PHP sites, add the widget to the shared footer or layout partial so every page inherits it automatically.
<!-- footer.php or a shared PHP layout partial -->
<?php /* Paste your Instro widget just before </body> */ ?>
<script
src="YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js"
data-user-id="YOUR_INSTRO_USER_ID"
defer
><\/script>
</body>If your PHP site uses multiple layout files, install the widget in the one shared by every page so it only loads once.
Check that the script is present in the final page HTML, that it only appears once, and that you published the change to the live site instead of only saving locally.
If your site uses a Content Security Policy, allow the Instro script origin in `script-src` and the API origin used by your widget in `connect-src`.
This usually means the snippet was added both in a global layout and on an individual page. Keep only one installation path.
Move the install to the root app layout so the script stays attached once instead of reloading on every page transition.