npm for app projects
Use `npm install instro-web-assist` when your site is built with React, Next.js, or another JavaScript bundler.
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, then install it with the `instro-web-assist` npm package for modern app projects or copy your Instro snippet into the stack that matches your website.
Universal snippet
Copy the snippet generated in your Instro dashboard. In the example below, your user ID is the value inside z7k9q1m, so z7k9q1m="16bnjxd" means your user ID is 16bnjxd.
<script
src="YOUR_INSTRO_WIDGET_URL/MudDt5Fdr.js"
z7k9q1m="YOUR_INSTRO_USER_ID"
defer
><\/script>Use that ID in npm and framework installs, or keep the whole snippet intact for CMS and plain HTML installs.
Rules
Use `npm install instro-web-assist` when your site is built with React, Next.js, or another JavaScript bundler.
Use the dashboard snippet for plain HTML, CMS platforms, ecommerce templates, and no-build websites.
Platforms
npm
For modern JavaScript apps, install the official Instro Web Assist SDK from npm and initialise it once near the root of your app.
npm install instro-web-assist
import InstroWebAssist from "instro-web-assist";
InstroWebAssist.init({
userId: "YOUR_INSTRO_USER_ID",
});Use the npm package when your site is built with a JavaScript bundler. Use the dashboard snippet for no-build sites, CMS platforms, and simple template installs.
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, use the React component from the `instro-web-assist` npm package and mount it once at the root.
npm install instro-web-assist
import { InstroWebAssist } from "instro-web-assist/react";
export default function App() {
return (
<>
{/* your app */}
<InstroWebAssist userId="YOUR_INSTRO_USER_ID" />
</>
);
}You can still use the dashboard script snippet if you prefer a script-tag install.
Next.js
For Next.js, install the npm package and render the React component from a small client component.
npm install instro-web-assist
"use client";
import { InstroWebAssist } from "instro-web-assist/react";
export default function WebAssistWidget() {
return <InstroWebAssist userId={process.env.NEXT_PUBLIC_INSTRO_USER_ID} />;
}Keep the user ID in a public environment variable only if it is intended to be available in browser code.
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>Nuxt's head management supports body-close scripts directly. If you prefer package-based setup, use the npm guide above.
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.