Control it from your code
Open the widget from your own buttons, tell it who the visitor is, and set options on the script tag.
Most sites never need this page: the widget works with the one line from Install the widget. Use it when you want your own buttons, a signed-in visitor's details, or settings in code.
Open it from your own button
Any element with the data-complaintr-open attribute opens the widget when clicked:
<button data-complaintr-open>Need help?</button>To open a specific screen, call ComplaintrWidget.open("report") from your button instead. This attribute is how a widget set to Hidden under Before it opens is opened.
JavaScript API
The widget adds window.ComplaintrWidget to the page.
| Call | What it does |
|---|---|
open(screen) | Opens the widget on Home, or on "messages", "news", "help", "report", or "feature" |
close() | Closes it |
toggle() | Opens it when closed, closes it when open |
isOpen() | Tells whether it is open |
hide(), show() | Hides the launcher and its greeting on this page, or brings them back |
identify({ name, email }) | Tells the widget who the visitor is, so its forms start filled in |
on(event, listener) | Listens for "ready", "open", or "close", and returns a function that stops listening |
off(event, listener) | Stops listening |
Calls made before the widget loads can wait in a queue, which the widget runs once it is ready:
<script>
window.ComplaintrWidget = window.ComplaintrWidget || [];
window.ComplaintrWidget.push(["identify", { name: "Ada", email: "[email protected]" }]);
</script>Script tag attributes
Settings can also be written on the script tag. Saved settings from the Appearance tab take over when the widget loads, except data-locale, which wins over the saved language.
| Attribute | Purpose |
|---|---|
data-app | Your project name, when it is not in the address as ?app= |
data-locale | en or tr. Defaults to the visitor's language. |
data-position | bottom-right, bottom-left, top-right, or top-left |
data-color | Hex color for the Home background, the launcher, and the buttons |
data-appearance | auto (follows the page), light, or dark |
data-title, data-welcome | The Home title (up to 80 characters) and the short line under it (up to 240) |
data-banner-title, data-banner-text, data-banner-url | The announcement banner |
data-launcher-icon | logo, chat, complaintr, bug, megaphone, or chevron |
data-launcher-style | gradient, white, or dark |
data-closed-state | button, card, email, mascot, tab, or hidden |
data-mascot | koala, fox, cat, bear, panda, penguin, owl, bunny, or robot |
data-offset-x, data-offset-y | Pixels the widget moves in from its corner, 0 to 160 |
data-tabs | The optional tabs to show, such as news,help |
data-actions | The Home shortcuts to show, such as report,feature |
data-popup | on shows the timed popup, with data-popup-kind (message, email, or campaign), data-popup-delay (seconds), data-popup-frequency (session, day, or once), and the optional data-popup-title, data-popup-body, and data-popup-cta |
data-ask-examples | Up to 8 example questions separated by |, typed out in the ask box |
data-endpoint | A different API address, for local testing or a proxy |
The project name can also come from window.ComplaintrSettings.app, which helps when a tag manager adds the script.