API for project-specific widgets

Project specific snippet


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:

Updated 4 months ago

API for project-specific widgets

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.