Get started

Install the script

Add Usercase once, in the head of every page. It loads asynchronously and does not block your page.

Script tag

Copy your install code from Settings → Installation in the dashboard. It already contains your project ID. Paste it before </head> on every page.

<script>
(function () {
  var w = window;
  if (!w.Usercase) { w.Usercase = {}; }
  w.Usercase.project = "YOUR_PROJECT_ID";
  function l() {
    if (w.UsercaseInitialized) { return; }
    w.UsercaseInitialized = true;
    var s = document.createElement("script");
    s.type = "text/javascript";
    s.async = true;
    s.src = "https://app.usercase.io/plugin/1.0.1/eb-plugin-web.js";
    var x = document.getElementsByTagName("head")[0];
    if (x) { x.appendChild(s); }
  }
  if (document.readyState === "complete") { l(); }
  else { w.addEventListener("DOMContentLoaded", l); w.addEventListener("load", l); }
})();
</script>

npm

Install the package and call init once, when your app starts.

npm install usercase

Options

OptionTypeDescription
projectstringRequired. Your project ID.
requireConsentbooleanWait for Usercase.consent(true) before starting. See Consent.

Let your agent install it

With the Usercase plugin connected, ask your coding agent to install it. It finds your root layout, adds the script once, shows you the diff and opens your local site to check that it loads. It does not commit or deploy.

Install Usercase on this site