Closed JamesPHoughton closed 3 months ago
If there is nothing in the qualtrics api that does what we want, we may be able to embed some JavaScript in the survey to detect if it is in an iframe, and report back the results to the parent window. There may be some cross-origin scripting issues to work around.
Looks like it would be simple to just know that a user completed the survey, as qualtrics already posts a message to the parent window on survey completion, which looks like QualtricsEOS|<survey_id>|<qualtrics_session_id>
This doesn't get you the data, though. It may be sufficient for now for us to just let qualtrics handle the data, and pass an identifier down to the embedded qualtrics via a URL parameter, and then advance the stage when the survey is complete. We could merge the datasets later, even though that is annoying...
Some react + iframe resources:
Because the completion message gets passed to the window object, we can only have one qualtrics survey on a page. Also, we may need to clear the message object if we want to do multiple qualtrics surveys in a row...
Currently runs a survey from the distribution URL and when the survey is submitted, advances the page. Does not fetch the survey responses.
Need to be able to pass url params to qualtrics to specify treatments, and conditions
- type: qualtrics
url: https://upenn.co1.qualtrics.com/jfe/form/SV_czNcL28CkElpBcO
params:
- Condition: Contact_Project
- party: rep
Also should define some standard URL params that get passed:
We want to use interventions from the Strengthening Democracy Challenge in empirica.
What we need is:
I'm happy to do this in vite app, so you don't have to worry about setting up the empirica experiment, then we'll move to empirica afterwards and write a cypress test.
What it should look like:
Resources
Qualtrics API: https://api.qualtrics.com/ Vite docs: https://vitejs.dev/guide/ Upenn's qualtrics page: https://upenn.co1.qualtrics.com/
@mykoal let me know if you have questions or get stuck