Run-time Options


With Saber Feedback’s run-time options, you can specify options for the feedback button and interface at run-time. This allows you to easily have different options for different pages, or depending on Javascript conditions.

Run-time options will always take priority over the options you specify in the form settings section of the control panel.

Run-time options are set using the Saber.do method of Saber Feedback’s Javascript API. There are two ways of using this method; setting a single option, and setting a group of options.

// set a single option
Saber.do('set_option', 'option_name', 'option_value');

// set multiple options
Saber.do('set_options', { option_name_1: 'option_value_1', option_name_2: 'option_value_2'}); 

These lines can go anywhere after this section of the JavaScript snippet:

window.Saber = {
    apiKey: 'not_a_real_api_key',
    com:[],do:function(){this.com.push(arguments)}
};

For example:

<!-- Saber Feedback button -->
<script type="text/javascript">
    (function () {
        window.Saber = {
            apiKey: 'not_a_real_api_key',
            com:[],do:function(){this.com.push(arguments)}
        };
        var e = document.createElement("script");
        e.setAttribute("type", "text/javascript");
        e.setAttribute("src", "https://widget.saberfeedback.com/v2/widget.js");
        document.getElementsByTagName("head")[0].appendChild(e);

        Saber.do('set_option', 'position', 'left');
    })();
</script>
<!-- End of Saber Feedback button -->

language string

Default: ‘en’

This specifies the language in which the user interface should be displayed, the value must be a 2 character language code, and can be any of the following:

  • en – English (default)
  • cz – Czech
  • de – German
  • dk – Danish
  • es – Spanish
  • fr – French
  • hu – Hungarian
  • it – Italian
  • nl – Dutch
  • pt – Portuguese
  • ru – Russian
  • se – Swedish
  • tr – Turkish
Saber.do('set_option', 'language', 'fr');

position string

Default: ‘right’

Can be either ‘left’ or ‘right’. Set this to ‘left’ if you would like the feedback button to display on the left hand side of the screen.

Saber.do('set_option', 'position', 'left');

style string

Default: ‘label’

Can be either ‘label’ or ‘tab’. Set this to ‘tab’ if you would like the feedback button to be displayed horizontally on the bottom of the screen, instead of vertically at the side of the screen.

Saber.do('set_option', 'style', 'tab');

label_text string

Default: ‘Feedback’

Modify this to change the label text on the feedback button. If you do not define this, the default of ‘Feedback’ will be used, and will be translated to the appropriate language if you set the language to anything but English.

Saber.do('set_option', 'style', 'tab');

feedback_values hash

Default: null

The feedback_values hash can be used to specify default values for your feedback fields, as well as Custom Data.

The hash is in the format { field_api_name: field_value }. The field’s API name can be found in the Form Builder section of the Saber Feedback control panel. Default field API names always start with an underscore.

Default feedback categories also have underscore prefixed API names which can be found in control panel when setting up your category field. This is so that the category names can be translated into other language.

Saber.do('set_option', 'feedback_values', {
    'Email': '[email protected]',
    Category: '_problem',
    user_id: 69,
  }
);

background_color string

Default: ‘#222222’

Controls the background color of the Feedback button. This can be any valid Hexadecimal RGB Color.

Saber.do('set_option', 'background_color', '#0064cd');

text_color string

Default: ‘#ffffff’

Controls the text color of the Feedback button, as well as the inner border color. This can be any valid Hexadecimal RGB Color.

Saber.do('set_option', 'background_color', '#000000');

show_thanks boolean

Default: true

Set this to false to simply exit Saber Feedback as soon as feedback is sent, instead of showing the “Thanks for the Feedback!” message.

Saber.do('set_option', 'show_thanks', false);

hide_button boolean

Default: false

If you set this to true, Saber Feedback will load normally, but the feedback button will not be shown. Instead you will be able to trigger Saber Feedback to open using the JavaScript API’s open method.

Saber.do('set_option', 'hide_button', true);

disable_event_log boolean

Default: false

If you set this to true, Saber Feedback will not log events, such as page loads, AJAX requests and Javascript errors.

Saber.do('set_option', 'disable_event_log', true);

event_log_max_length integer

Default: 100

If you set this to true, Saber Feedback will not log events, such as page loads, AJAX requests and Javascript errors.

Saber.do('set_option', 'event_log_max_length', 420);

cookies hash

Default: null

Beta - This feature is currently in beta, and may not always work. Please get in touch if you find any issues with it.

Use this to set cookies on Saber Feedback’s screenshot server. Eg: if your site’s CSS or images require authentication, you can specify an authenticated cookie value so that the Saber Feedback screenshot server can access them.

The cookies hash should be in the format of URL: { cookie_name: cookie_value }. Multiple URLs can be specified, and each URL can have multiple cookies (see the example below).

The URL is required as the screenshot server first needs to navigate to this URL in order to set the cookie. It’s best to choose a fast loading page to keep screenshot creation as quick as possible.

Please note: The URLs must be for HTML documents, as some browsers will not allow cookies to be set on images or any other non-HTML URLs.

Saber.do('set_option', 'cookies', {
    'https://yoursite.com': {
       cookiename:'cookievalue',
       cookie_two:'something'
    },
    'https://google.com': {
      more:'cookies'
    }
  }
);

suppress_localhost_warning boolean

Default: false

Set this to true to hide the localhost warning message that is displayed when running Saber Feedback on a local environment.

Saber.do('set_option', 'suppress_localhost_warning', true);

display_screenshot_button boolean

Default: true

Set this to false to hide the “Add screenshot” button from your feedback form.

Saber.do('set_option', 'display_screenshot_button', false);