Displaying (iframing) or linking to a Qualtrics survey from your Lagunita course is simple to do.
The code to iframe a Qualtrics survey looks like this:<iframe src="URL_of_your_survey&a=%%USER_ID%%" height="1000" width="800" />
The additional code, &a=%%USER_ID%%, passes an anonymous User ID to your survey so you can correlate responses back to the user who submitted the survey.
The height and width values can be changed as you like, but those values are about the size of a single page so users won't need to scroll, depending on how you set up your survey.
There is example code for this in the Anonymous User ID HTML component. The code for this type of HTML component includes how to set your survey link to include an anonymous User ID and have your survey open in either a new tab/window (with the target=”_blank” parameter) or be iframed into the page.
To record the anonymous User ID so you can correlate Qualtrics responses back to OpenEdX users, you need to set your survey to look for the “a” value used above. You do this by editing your survey and clicking Survey Flow:
Click “Add new Element Here” and select “Embedded Data”. If your survey already has Embedded Data, you can add additional parameters by clicking “Add a New Field” within the Embedded Data pane:
In the Embedded Data pane, add the value that you are passing in the link (“a” is the default value, but you can make this whatever you like, as long as the value is the same in the link and in the survey Embedded Data):
When you are done, click Save Flow at the bottom of the page.
You can now test that the anonymous User ID is recorded by submitting your survey through the Lagunita course. Once you submit the survey, you should see the “a” value (or whatever value you set up) in your survey results and see an anonymous ID that looks something like this: