Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Language, Location and Captcha

Hi all

I have a client who wishes to record a respondent's language setting and their location.  Is this possible?  Maybe using javascript, IP address, or some combination?

And he would also like to add a Captcha (or anti-spam verification - much like what we put in when we ask a question here without logging in).  Has anyone done this in a survey?

Thanks ... we're using 8.3.8 currently.
asked Jan 21, 2015 by anonymous

1 Answer

0 votes
I found these two posts discussing browser language preferences:
http://stackoverflow.com/questions/1043339/javascript-for-detecting-browser-language-preference

http://stackoverflow.com/questions/8199760/how-to-get-the-browser-language-using-javascript?lq=1

IP address can give you a general idea using geo-location, though it's not 100% reliable.

I've never done a Captcha before, but it should be doable since you can add your own code to a survey page in a variety of languages.  Spam isn't typically a concern for surveys, since the link to your survey is usually only up for a short amount of time and most spam bots don't click radio buttons/checkboxes page after page.  If you are using a panel or sending out your own invites to take the survey, potentially assigning users their own unique password as part of their invitation link is an easier approach.
answered Jan 21, 2015 by Brian McEwan Gold Sawtooth Software, Inc. (39,170 points)
Thanks, Brian - I got country and language working in 8.3.8 using this:

<input name="GeoData_country" id="GeoData_country" type="hidden">
<input name="GeoData_language" id="GeoData_language" type="hidden">

<script type="text/javascript">
$.getJSON('http://api.wipmania.com/jsonp?callback=?', function (data) { 
     
    var country = data.address.country;
     
    jQuery('#GeoData_country').val(country);
 
}); //EO document ready
</script>

<script type="text/javascript">
{ 
     
    var userLang = navigator.language || navigator.userLanguage;
     
    jQuery('#GeoData_language').val(userLang);
 
}; //EO document ready
</script>


BUT ... since upgrading to 8.3.10, the language bit still works but the country bit doesn't.  Can anyone spot whatever might be causing it not to work?
Hm, that's odd that custom JavaScript would stop working with that update.  Unfortunately I'm very weak on JavaScript and especially jQuery using an API of a website!  It looks like WIPmania uses IP address, which again isn't 100% reliable, but probably a lot better than nothing since I wouldn't expect most survey takers to spoof their IP or be using a VPN.

Perhaps it might be best to make a new forum post to get the attention of someone with the requisite knowledge to help?  Or at least someone smarter than me in this area  :)
Cheers, Brian - will do.  Thanks for getting me as far as I've got.  Much appreciated.
...