A few widgets on one page
Artur Zbiejcik avatar
Written by Artur Zbiejcik
Updated over a week ago

We often hear this question: What will happen if the rules for displaying two surveys per website are met? Will they appear on the website simultaneously?

The answer is YES. In the new version of this form of distribution (survey as a popup on the page), if you run two surveys, which should appear on each page and for each user, the two of them will appear at the same time.

In such a situation, it is worth making sure that one popup does not cover the other - as long as it is the intended purpose.

The exception is when one of the surveys is already completed. Then only the one which has not yet been filled will be displayed.

Enforcing the order of the widgets' display

If you want to enforce the order in which the widgets appear, you can do it by using the display rule based on the JavaScript code.

Let's suppose you want the survey with the ID 123456 to be displayed first, and only after it is completed, the survey with the ID 654321 should be displayed.

For this to work in survey number 2, you need to define the following display rule


โ€‹

function widgetJSRule () {
var itemName = 'startquestion-widget-123456';
var item = localStorage.getItem (itemName);
item = JSON.parse (item);
if (item.filled) {
complete (true);
}
else {
complete (false);
}
}

The information that the survey is completed is in the localstorage under the key 'startquestion-widget-123456'.

Under this key there is an object which has a filled field. Depending on the value of this field, it is known whether the survey has already been completed.

Did this answer your question?