window.TarsWidget, the host-page control object created by embed.js. It exists only with the script embed method, not with a direct iframe.
Availability
embed.js defines window.TarsWidget only after it loads the agent’s widget settings, so the object can be missing when your own script runs. Guard early calls.
Methods
Badge behavior
The badge renders only while the widget is closed. Opening the panel clears it. The widget also sets the badge itself from unread live-chat messages, so callshowBadge only for your own counts.
identify
identify verifies an end user who signs in after the conversation already started. The widget forwards the signature to Tars, which verifies it server-side. The payload’s sub claim must equal the widget’s channelUserId, see Identity signing for the full contract.
