qualtrics-map
v0.1.0
Published
map component
Downloads
16
Readme
qualtrics-map
A react-based component that displays an embedded google map in Qualtrics.
Features
- Collection of multple answers in one question.
- e.g., "From:" and "To:"
- Use either of address bar with autocomplete or map marker
Installation
Google Maps API
This library uses Google Maps Javascript API and Places API.
Make sure you have a key to access those APIs.
Serve bundle.js
- Clone or download the repository.
npm ci
npm run build
- Anywhere in your local environment, create an empty text file
bundle.txt
. - Go to the files library on qualtrics.
- Upload the text file.
- Click the uploaed file and then "Edit" on the right-top.
- Select "Choose a new file from your computer" and upload the
bundle.js
.
Qualtrics Survey Settings
- In the survey settings and click Look & Feel on the top.
- Select "General" tab and then edit the "Header".
- In the editor, click the paper icon to insert the bundle file.
- Select
bundle.js
. - Click the "<>" icon to enter coding-view.
- Copy the url of href attribute.
- Copy and paste the following code, replacing the
[apiKey]
and[fileUrl]
with respectively the API key and the url.
<script>
var apiKeyGoogleMap = "[apiKey]";
</script><br />
<script src="[fileUrl]"></script>
Use It
- The question that you want add the map has to be set as "Text Entry" question.
- Add / remove text fields and set the field tag as you need. (e.g., Two text fields named "From:" and "To:".)
- In the question, click the gear icon and then "Add Javascript..."
- Copy and paste the following code.
- All done!
Qualtrics.SurveyEngine.addOnload(function()
{
mapRender(apiKeyGoogleMap);
});