Skip to content

Install

Install MivoChat on a React site

A small SaaS team can add MivoChat to a React marketing site through its shared HTML document.

Copy the exact snippet from the Install page and place it once in the shared HTML shell or framework root. Allow the deployed origin, then test a full conversation after client-side navigation.

Prefer to let your AI coding agent do it? Copy the agent prompt.

Installation steps

  1. 1

    Prepare

    Copy the snippet for this React site's hostname from its MivoChat Install page.

  2. 2

    Configure

    For Vite, add <script src="https://mivochat.app/widget.js" data-site="YOUR_SITE_KEY" async></script> to index.html; for Create React App, use public/index.html. A client-only embed can create a script element in useEffect, set its src, async, and dataset.site, then append it to document.body once.

    <script src="https://mivochat.app/widget.js" data-site="YOUR_SITE_KEY" async></script>
  3. 3

    Publish

    Add the production origin to MivoChat's allowed websites and update CSP if configured.

  4. 4

    Verify

    Deploy and test a docs question, an unsupported question, and navigation between routes.

Load the script once

Avoid mounting the loader inside a component that re-renders or appears on every route. The shared HTML shell gives the widget one stable place to initialize.

If you choose a client-only effect, guard it against adding a second script element and give the element the data-site attribute before appending it. React Strict Mode intentionally reruns effects in development, which can expose an unsafe loader implementation before users see duplicate launchers in production.

import { useEffect } from "react"

export function MivoChatLoader() {
  useEffect(() => {
    if (document.querySelector('script[data-site="YOUR_SITE_KEY"]')) return
    const script = document.createElement("script")
    script.src = "https://mivochat.app/widget.js"
    script.async = true
    script.dataset.site = "YOUR_SITE_KEY"
    document.body.appendChild(script)
  }, [])
  return null
}

Check the real site

Test the published application in a browser tab, not an embedded editor preview. Confirm the launcher, visitor message, and teammate reply all work after navigating to another page.

For Vite, inspect the final dist/index.html; for Create React App, inspect the generated build/index.html. Search the output for the loader, then open DevTools Network and check whether the script request or a later API request is blocked. If only one hostname fails, add that exact origin in Install settings → Allowed websites instead of changing the loader key.

Before you change the setup

Who this is for
a client-rendered React application with a Vite or Create React App HTML shell
What you need
the source HTML shell, a development server, the deploy hostname, and the correct public site key
Where it goes
Vite index.html or Create React App public/index.html, before </body>
Watch out for
React route changes do not reload the document, so putting a new script element in each route component is unsafe

Test the support boundary

  • Where is the endpoint for listing projects?
  • How do I rotate a webhook secret without downtime?
  • What should I do if an SDK method is undocumented?

Frequently asked questions

The loader is nested inside a React component

Move the script to the HTML shell so component renders and route transitions cannot append additional loader elements.

An effect runs twice in development

React Strict Mode can repeat development effects; prefer the static shell rather than using an effect to append the same external script.

The bundle loads but API calls fail

Check Network and the console for CSP restrictions, then add the MivoChat origin to connect-src and frame-src as well as script-src. The Content Security Policy guide lists every directive.

Only the apex domain is approved

Add each hostname visitors actually use, such as both example.com and www.example.com, under Install settings → Allowed websites.

Keep exploring

The r3-final-a evaluation measured 95% answerability-tier accuracy on 224 questions; this is an evaluation result, not a guarantee. AI replies use Anthropic. See the method and results and subprocessors and data locations.

Try MivoChat on your support pages.

Start a 14-day trial, connect public pages, and test what gets answered or handed to your team. Check current paid billing status on pricing.