Using pop-up windows to display questionnaires is considered to be the most convenient and fast way to collect user information. After the first questionnaire was created, we kindly asked people if they were willing to fill out the form, but the results were disappointing. So we decided to put this questionnaire on our homepage and pop up automatically when people visit, and the effect is unexpectedly good.
Here are our secrets to success:
1: The automatic pop-up window can only be displayed once, regardless of whether the user has filled out the questionnaire.
2: The automatic pop-up window cannot affect the display speed of the home page.
3: The automatic pop-up window will automatically disappear after the user fills in the questionnaire.
4: The automatic pop-up window is displayed in the upper left side of the screen.
5: Do not add ads in the automatic pop-up window, because our purpose is to get user survey reports.
To determine whether the window is popped up, we used a small cookie. We define a cookie that can be used multiple times and judged multiple popups. We name this cookie "s", which contains the ids of all the windows that have been popped up.
Now, when the user visits the home page, we determine whether the requested id is already included in the cookie. If the cookie does not exist, we pop up the window and write the cookie to prevent the window from popping up again.
In the following example, we write cookies on the server side, which can be achieved using JavaScript. We chose the server side because it is relatively simple.
At the beginning of our homepage, we execute the asp code. This code should be placed before HTML output because we need to edit the header.
<%
DimbSurvey'Does the questionnaire show
constbID="1"' id of the questionnaire
bSurvey=false
'Check if the questionnaire has been shown
ifinstr(request.cookies("s"),":"&bID&":")=0then
'The questionnaire is not shown, update cookies
'Set the cookie expiration time to 60 days
response.cookies("s").expires=DateAdd("d",60,now())
'Set the path
response.cookies("s").path="/"
'Write cookies
response.cookies("s")=request.cookies("s")&":"&bID&":"
bSurvey=true
endif
%>
We give each questionnaire an id, and if you have multiple popups, it can be easily planned for output.
We add an asp script at the end of the page to determine whether the pop-up window is displayed. This script is at the end of the page and will not affect the download speed of the home page. This script is very simple, it uses window.open() to open a new window.