Code to change piped GeoIP state data from abbreviation symbol (e.g. CO) to word (e.g. Colorado)? | XM Community
Skip to main content
Hi

I am using the GeoIP data in the instruction text of a survey, to suggest that the events occurred in the respondent's state. However the GeoIP data is in abbreviation form rather than the proper names. I am not at all proficient in coding. Searched github but can't find anything. Anyone able to share some javacript for this?!

Thanks!
Chris
Have you tried using ${loc://CountryName} as embedded data value as opposed to Area Code:
!
@cmbell,

Create a JavaScript object keyed by abbreviation, then do a lookup:
```
var states = {
...
"CO" : "Colorado",
...
};
Qualtrics.SurveyEngine.setEmbeddedData("state",states['${loc://Region}']);

Leave a Reply