e-satisfaction

Override web display settings

Display settings normally live in the dashboard: the widget's type, position, mobile behaviour, language detection and frequency caps are all configured on the Web integration page, and the standard snippet just loads collection. That's the right setup for almost every site.

Occasionally you need different behaviour on different pages of the same site — for example, force a language on a localized page, change the delay on a slow-loading flow, or turn mobile display off in one place. For those cases you can override the display settings directly in the snippet by passing a configuration object as the fourth argument.

Overriding takes the settings out of the dashboard

Once you override a questionnaire's display settings in code, you can no longer change those settings from the dashboard — the snippet wins. Only override what you genuinely need to vary per page, and remember that any future change means editing your site again.

How overriding works

The standard snippet passes an empty object ({}) as its fourth argument. To override, pass an object keyed by questionnaire ID instead, with the settings you want to force:

(function (w, d, id, c) {
   w.esat_config = {application_id: id, collection: c || {}};
   w.Esat = w.Esat || {};
   w.Esat.updateMetadata = function (q, m) {
       w.esat_config.collection[q] = w.esat_config.collection[q] || {};
       w.esat_config.collection[q].metadata = m;
   };
   var l = function () {
       var r = d.getElementsByTagName('script')[0], s = d.createElement('script');
       s.async = true;
       s.src = 'https://collection.e-satisfaction.com/dist/js/integration' + (!!w.jQuery ? '' : '.jq') + '.min.js';
       r.parentNode.insertBefore(s, r);
   };
   "complete" === d.readyState ? l() : (w.attachEvent ? w.attachEvent("onload", l) : w.addEventListener("load", l, false));
})(window, document, 'YOUR-WORKSPACE-ID', {
   "YOUR-QUESTIONNAIRE-ID": {
       "questionnaire_id": "YOUR-QUESTIONNAIRE-ID",
       "active": true,
       "active_mobile": true,
       "type": "embed",
       "position": "#collection-holder",
       "position_type": "inside",
       "locale": "",
       "locale_autodetect": true,
       "delay_cap_minutes": 0,
       "delay_cap_hours": 0,
       "delay_cap_days": 0,
       "frequency_cap_minutes": 0,
       "frequency_cap_hours": 0,
       "frequency_cap_days": 0
   }
});

Always include the questionnaire_id

Include the questionnaire_id option inside every override block, matching the key it sits under. The override won't be applied without it.

What you can override

SettingWhat it controls
activeWhether the questionnaire shows at all on this page.
active_mobileWhether it shows on mobile devices.
typeThe widget type — e.g. embed.
positionWhere the widget is placed (a CSS selector for embedded widgets).
position_typeHow it's inserted relative to the position element.
localeThe language code to display in.
locale_autodetectWhether to auto-detect the visitor's language.
delay_cap_minutes / _hours / _daysHow long to wait before showing the questionnaire.
frequency_cap_minutes / _hours / _daysHow long before the same visitor sees it again.

Force a specific language

A common reason to override is to fix the display language on a localized page. Set the locale to the language code and turn auto-detection off so it can't be overridden by the visitor's browser:

"YOUR-QUESTIONNAIRE-ID": {
    "questionnaire_id": "YOUR-QUESTIONNAIRE-ID",
    "locale": "es",
    "locale_autodetect": false
}

Don't override allowed domains

The allowed-domains whitelist and blacklist are validated on both the browser and the back end, so overriding them in the snippet has no effect. Manage allowed domains from the Web integration page instead.