Qualtrics with Google Map - Default Location | XM Community
Skip to main content
Hello,



I am trying to change the default location of Google Map that I integrated into my Qualtrics survey (I refer to the GitHub for this: https://github.com/pkmnct/qualtrics-google-map-lat-long).



My question is how I can change the default location based on the respondent's location.



Here is my logic:

1) Remember the respondent's city using ${loc://City}

2) Based on the recorded city name, change the latitude and longitude. For example, I tried like this:



var mapCenterLat;

var mapCenterLng;



if ("Austin".equals("${loc://City}")){

mapCenterLat = 30.267294;

mapCenterLng = -97.749340;

}

else if ("Houston".equals("${loc://City}")){

mapCenterLat = 29.755742;

mapCenterLng = -95.369886;

}



else {

mapCenterLat = 30.310873;

mapCenterLng = -95.455806;

}





But I failed to load the Google Map.



I think I did not use if-then statement of Java appropriately, but I cannot figure out what is wrong.



Please advice me. Thank you very much in advance.
Your if statements should look like this:

```

if ("Austin" == "${loc://City}")

```
@TomG

Thank you very much! It works-

Leave a Reply