# Delay script load

**Use case**: Support should only be offered to logged in customers, or customers of a particular plan / subscription type.

```html
<script
  defer
  src="https://widget.mava.app"
  widget-version="v2"
  id="MavaWebChat"
  data-token="YOUR_DATA_TOKEN"
  delay-load="true" // This is the important line
></script>

```

Adding this to your script will ensure that the Mava web chat doesn't automatically run on page load. Instead you will need to dispatch a custom window event to trigger the script to run.

<pre class="language-html"><code class="lang-html">&#x3C;button
  onclick="
    var newEvent = new Event('loadMavaWebchat');
<strong>    window.dispatchEvent(newEvent);
</strong>    ">
  Load Mava Script
&#x3C;/button>
</code></pre>

You can trigger this event from any source in your code, e.g as a reaction to a fetch event where the users credentials are checked and verified.\
\
After this event has been dispatched you can then use Mava in the normal manner, either with our default Mava web chat icon launcher, or a custom launcher.
