Saber Feedback Documentation

Javascript Events


on_ready

The on_ready event is triggered as soon a the Saber widget is loaded and ready for use, ie: as soon as the feedback button has been added to your webpage. There are no arguments passed to the on_ready event handler.

Example:

Saber.do('set_option', 'on_ready', function() {
    alert('Saber is ready!');
  }
);

on_open

The on_open event is triggered when the Saber button is clicked, or the widget is opened using the Saber.open() Javascript API method. There are no arguments passed to the on_open event handler.

Example:

Saber.do('set_option', 'on_open', function() {
    alert('Saber opened!');
  }
);

on_complete

The on_complete event is triggered when a feedback report is submitted through Saber. A Javascript hash containing details about the submitted feedback report is passed to the event handler, in the following format:
{
  feedback_report: {
    id: "a1b2c3d4e5f6",
    full_details_url: "https://app.saberfeedback.com/websites/g7h8i9j0k1l2/feedback/a1b2c3d4e5f6",
    screenshot_url: "https://api.saberfeedback.com/feedback/16dcfb9d4936480377dd5c1e0a331a444dbe626a/screenshot",
    user_agent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/604.1.38",
    browser_name: "Safari",
    borwser_version: "11.1.2",
    os_name: "Mac OS X",
    os_version: "High Sierra",
    viewport_width: 1280,
    viewport_height: 720,
    url: "https://app.saberfeedback.com",
    plugins: [
      "Widevine Content Decryption Module",
      "Chrome PDF Viewer",
      "Shockwave Flash",
      "Chrome Remote Desktop Viewer",
      "Native Client"
    ],
    events: [
      {
        url: "https://app.saberfeedback.com",
        method: "GET",
        timestamp: "Mon Oct 19 2015 13:51:17 GMT+0100 (BST)",
        type: "page_load"
      },
      {
        content: "Feedback Button Clicked",
        timestamp: "Mon Oct 19 2015 13:51:27 GMT+0100 (BST)",
        type: "feedback"
      },
      {
        content: "Feedback Report Submitted",
        timestamp: "Mon Oct 19 2015 13:51:37 GMT+0100 (BST)",
        type: "feedback"
      }
    ],
    values: {
      Category: "Question",
      Email: "matt@saberfeedback.com",
      Message: "This is a bug!",
      user_id: 12345
    }
  }
}

Example:

Saber.do('set_option', 'on_complete', function(data) {
    alert('Feedback submitted by '+data.feedback_report.values.Email+'!');
    // -> Feedback submitted by matt@saberfeedback.com!
  }
);

on_cancel

The on_cancel event is triggered when a user manually closes Saber without submitting a feedback report. There are no arguments passed to the on_cancel event handler.

Example:

Saber.do('set_option', 'on_cancel', function() {
    alert('Saber canceled!');
  }
);

on_close

The on_close event is triggered when the Saber widget is closed, either by user interaction or through the Saber.close() Javascript API method. This event will be triggered regardless of whether a feedback report was submitted or not, and will alays be triggered after on_complete or on_cancel is triggered. There are no arguments passed to the on_close event handler.

Example:

Saber.do('set_option', 'on_close', function() {
    alert('Saber closed!');
  }
);