Survey respondents are increasingly using mobile devices (smartphones and tablets) to respond to surveys. Using a Limesurvey template designed for PC will not provide a good user experience on smaller screens. Radio buttons and checkboxes will be cumbersome on small screens if you use templates designed for larger PC/laptop screens using CSS.
How to provide the best possible user experience to both PC and mobile users?
Here is a solution that works for me.
First get a template that is designed for smartphone/tablets (see limesurvey-templates.com).
Steps:
1. Create survey using your favorite Limesurvey template (PC survey)
2. Copy the survey (give it a different name) and use the smartphone/tablet survey. (hint: only 1-2 questions per group, to ensure easy navigation on small screens).
3. Save the following PHP script in any folder. I would recommend creating a folder for each survey or client and naming the script file as index.php (but this is not mandatory).
For example create a folder called survey1 (
www.mysite.com/survey1) and place the index.php file in that folder. Change the last two lines of the script to point to your mobile survey and PC survey URLs respectively. In your survey invite, you only need to provide the short URL "
www.mysite.com/survey1". The script will detect the device/browser type and redirect the user to the PC or mobile version of the survey.
4. You will have two survey databases to deal with. You can manually append the data from one CSV or SPSS file into the other (this is easy if you survey runs only for a specific time period). In my case, I have a script that runs automatically at defined intervals and combines the data.
The script is courtesy of
mobiforge.com/developing/story/lightweight-device-detection-php.
PLEASE NOTE: The script is based on 90 or so "well-known mobile browser User-Agent string snippets." I have so far tested it on iPhone, Blackberry and PC. The survey loads very quickly. Please test it before using it. I am not responsible for errors or failures.
<?php
$mobile_browser = '0';
if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i',
strtolower($_SERVER['HTTP_USER_AGENT']))){
$mobile_browser++;
}
if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or
((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))){
$mobile_browser++;
}
$mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4));
$mobile_agents = array(
'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac',
'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno',
'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-',
'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-',
'newt','noki','oper','palm','pana','pant','phil','play','port','prox',
'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar',
'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-',
'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp',
'wapr','webc','winw','winw','xda','xda-');
if(in_array($mobile_ua,$mobile_agents)){
$mobile_browser++;
}
if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini')>0) {
$mobile_browser++;
}
if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')>0) {
$mobile_browser=0;
}
if($mobile_browser>0){
header('Location: http://www.mysite.com/mobilesurvey');
} else {
header('Location: http://www.mysite.com/pcsurvey');
}
?>
If Limesurvey has a built-in browser detection feature, that would be really helpful. If a single survey can be displayed using two different templates based on device type, then the back-end integration of data from two different databases can be avoided.
But in the meanwhile, the solution I have might be helpful to others.
rvenkat