Usersnap 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

load – The widget was loaded (initialized)

destroy – The widget was destroyed

open – The widget was opened

close – The widget was closed

submit – The widget’s form was submitted

Installation widget and exposing API

  window.onUsersnapCXLoad = function(api) {
  var script = document.createElement('script');
  script.async = 1;
  script.src = '<<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"

Passing user information via the API

You can pass user information to Usersnap to increase the options to target specific user groups and provide targeted experiences.

// assuming a global widget config looking something like this
window.onUsersnapCXLoad = function(api) {
    user: {
      email: "[email protected]", // Email address
      userId: "USER_ID", // on client system

Examples on popular frameworks

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

Updated 4 days ago

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