Complaintr Docs

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:

Code
<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.

CallWhat 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:

Code
<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.

AttributePurpose
data-appYour project name, when it is not in the address as ?app=
data-localeen or tr. Defaults to the visitor's language.
data-positionbottom-right, bottom-left, top-right, or top-left
data-colorHex color for the Home background, the launcher, and the buttons
data-appearanceauto (follows the page), light, or dark
data-title, data-welcomeThe Home title (up to 80 characters) and the short line under it (up to 240)
data-banner-title, data-banner-text, data-banner-urlThe announcement banner
data-launcher-iconlogo, chat, complaintr, bug, megaphone, or chevron
data-launcher-stylegradient, white, or dark
data-closed-statebutton, card, email, mascot, tab, or hidden
data-mascotkoala, fox, cat, bear, panda, penguin, owl, bunny, or robot
data-offset-x, data-offset-yPixels the widget moves in from its corner, 0 to 160
data-tabsThe optional tabs to show, such as news,help
data-actionsThe Home shortcuts to show, such as report,feature
data-popupon 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-examplesUp to 8 example questions separated by |, typed out in the ask box
data-endpointA 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.

On this page