API for project-specific widgets (old version)

Project specific snippet



We recommend using the global snippet and its API for showing and hiding feedback buttons and widgets. The project-specific snippets and API will only be maintained and not enhanced in the future.


API for project-specific snippets

This snippet will only work for this project and ignore all display rules of this and other projects. Moreover, this version of the API has its own methods, listed below.

If you are using the global snippet for the installation of the Usersnap feedback platform, please go to this API docu.

Project-specific widgets react to the following events

Please, read the documentation about the events in the general Usersnap API section

Installation widget and exposing API

  window.onUsersnapCXLoad = function(api) {
  var script = document.createElement('script');
  script.async = 1;
  script.src = 'https://widget.usersnap.com/load/<<PROJECT_API_KEY>>?onload=onUsersnapCXLoad';

Setting default values - email address

api.on('open', function(event) {
    event.api.setValue('visitor', '[email protected]');

Customizing the feedback button

  button: {isHidden: true}; //hiding the button
  button: {
    position: "rightCenter" //or "rightBottom" or "bottomRight"

Changing visibility of the button via API



Opening the widget via the API


Setting custom data via the API

api.on('open', function(event) {
    event.api.setValue('custom', {userID: 'u123', enviroment: 'staging'});

You can pass any data that is of interest to you as "custom data".

This data you can view on the feedback's detail screen under "More details" -> "Custom data"

Examples on popular frameworks

Check out sample code for installing widgets in different popular frameworks in the repository below: