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

Qualtrics with Google Map - Default Location

  • March 7, 2019
  • 2 replies
  • 49 views

Forum|alt.badge.img+1
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.

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • March 7, 2019
Your if statements should look like this: ``` if ("Austin" == "${loc://City}") ```

Forum|alt.badge.img+1
  • Author
  • March 7, 2019
@TomG Thank you very much! It works-