On-site Feedback (Deprecated)

Feedback Properties

Configuration

You can configure the on-site feedback properties as described below.

PropertyTypeDescriptionDefault value
delayNumberTime delay, in milliseconds, to show the feedback tab on a page.null
defaultRenderBooleanIf set to false, the feedback tab is not displayed by default.true
customDataObjectSpecify your custom data for feedback here in JSON format to submit along with every feedback that gets submitted. If not set then webengage.customData is referred.null
formDataArray of ObjectSpecify values in the feedback form for pre-population of the fields. This is illustrated in the examples below.null
alignmentStringShows the feedback tab on the left/right side of the webpage. The possible value that you can specify here is left or right.As specified in feedback tab configuration on dashboard.
borderColorStringRenders feedback tab with the specified border color.As specified in feedback tab configuration on dashboard.
backgroundColorStringRenders feedback tab with the specified background color.As specified in feedback tab configuration on dashboard.
defaultCategoryStringShows the feedback form based on the feedback category specified here.As specified in feedback tab configuration on dashboard.
showAllCategoriesBooleanIf set to true, the feedback form appears with feedback category dropdown menu to let the end users submit contextual feedbacks. If set to false, the feedback form appears based on the default feedback category specified without any feedback category dropdown menu.true
showFormBooleanIf set to true, feedback form slides out on page load by default.false

formData Object

PropertyTypeDescription
nameStringLabel of the field in the feedback form which you want to pre-populate with data, or want to hide, or make it mandatory.
valueStringSpecify the value of the field.
modeStringSpecify if the field should be hidden, read-only or default (no-change). Supported values are hidden, readOnly and default.
isMandatoryBooleanSpecify if the field should be mandatory or not.
optionsArray of StringApplicable only in case of ‘Category’ field. Specify in case you want to show specific values in the category dropdown.

Usage examples

  1. Align feedback tab to the right.
webengage.feedback.options('alignment', 'right');
  1. Set feedback tab background and border colors.
webengage.feedback.options({
	'backgroundColor' : '#ff9',
	'borderColor' : '#f99'
});
  1. Pre-populate email field and keep it read-only, hide message and specific options for category drop-down.
// Values in the category drop-down 'Like' & 'Question'

webengage.feedback.options('formData', [
	{
		'name' : 'email',
		'value' : '_EMAIL_VALUE_',
		'mode' : 'readOnly'
	}, {
		'name' : 'message',
		'mode' : 'hidden'
	}, {
		'name' : 'category',
		'isMandatory' : false,
		'value' : 'like',
		'options' : ['Like', 'Question'] // make sure you send right category lables
	}
]);

Feedback Methods

webengage.feedback.render()

This method allows you to override feedback settings as configured on WebEngage dashboard. It also overrides any provided global configuration properties on the page. This method accepts all feedback configuration properties.

Usage examples

  1. Show a feedback on click of a button.
webengage.onReady(function(){
	document.getElementById("_BUTTON_ID_").onclick = function () {
		webengage.feedback.render({ 'showForm' : true });
	};
});

webengage.feedback.clear()

This method clears any rendered feedback.

Usage Example

  1. Clear a feedback on click of a button.
document.getElementById("_BUTTON_ID_").onclick = function () {
	webengage.feedback.clear();
};

Showing Feedback Widget on Select Pages

You can add the following code snippet to the WebEngage Website SDK to prevent the feedback widget from displaying on select pages.

<script type="text/javascript">
  var _weq = _weq || {};
  _weq['webengage.onReady'] = function(){
    webengage.notification.render();
    webengage.survey.render();
    var pageUrl = document.location.href;
    //Hide widget on /terms page
    if(pageUrl != 'http://www.mywebsite.com/terms'){
      webengage.feedback.render();
    }
  };
</script>

In the script above, the feedback widget has been disabled for the URL http://www.mywebsite.com/terms. Simply replace this URL with links of the pages you would like to disable the feedback widget for, on your website.

Please feel free to drop in a few lines at [email protected] in case you have any further queries. We're always just an email away!