The widget's script gives your page a small JavaScript API. Use it to open the panel from your own button, open help at the right article, sign your users in and show your own "new" dot. It assumes you've added the widget to your site.
Use your own button
To hide Tuti's button and open the panel from yours, add data-hide-launcher to the script tag:
<script src="https://tuti.so/widget.js" data-project="your-project" data-hide-launcher async></script>
<button onclick="Tuti.open()">Help</button>Open help at an article
Any element with data-tuti-article opens the panel at that article when it's clicked. The value is the end of the article's /docs/โฆ address:
<a href="https://your-project.tuti.so/docs/exporting-your-data" data-tuti-article="exporting-your-data">How do exports work?</a>With an href, the link still works where the script isn't loaded. A click with Ctrl, Cmd or Shift held, to open a new tab or window, still follows the link. Elements your page adds later work too.
Call the widget
Once the script has run, window.Tuti has:
Call | What it does |
|---|---|
| Opens the panel where it was: Home the first time. |
| Opens it at |
| Opens it at an article from your docs. |
| Closes it, as Escape and the panel's close button do. Inline panels stay. |
| Signs your users in. |
|
|
|
|
| Calls |
Tuti.open() works with every data-display, and with inline it opens a floating panel. It can also open a part you turned off under Show in the widget, and Tuti.unseen() counts those parts, while Tuti's own button leaves them out. See Customize the widget's button and Home.
Show a dot on your own button
Tuti.on("unseen", (unseen) => {
document.querySelector("#help-dot").hidden = !unseen;
});For people you sign in, seeing an update on one device clears the dot on their others.
Sign someone in or out
Call Tuti.identify() after the script loads, or set identify in TutiSettings before it (below). The widget calls getToken whenever it needs a token, and sends the token only to your portal. When someone signs out of your app, call Tuti.identify() again with a function that returns nothing: the widget then shows nobody's conversations or ideas.
Tuti.identify(() => null);Set things up before the script loads
Instead of attributes on the script tag, you can set window.TutiSettings before the script:
<script>
window.TutiSettings = {
identify: () => fetch("/tuti-token").then((response) => response.text()),
display: "sidebar",
hideLauncher: false,
theme: "auto",
};
</script>
<script src="https://tuti.so/widget.js" data-project="your-project" async></script>Setting | Same as |
|---|---|
|
|
|
|
|
|
|
|
Where the script tag has the attribute too, the attribute wins.
If something doesn't work
The widget writes what's wrong to your browser's console, starting with "Tuti widget:", for example when data-project is missing or a tab name isn't one of the five.

