Passing UserID to Qualtrics from Coursera

This information below is a copy of Rene Kizilcec's MOOC Researcher Wiki at

Note that this method requires admin access to your Coursera course, which is not allowed for researchers - only teachers and TAs. (Coursera wants to protect user privacy.) So either get yourself a TA position, or perhaps coordinate with the teacher/TA to use their account under their supervision.

  1. Create your Qualtrics survey, and go to "Survey Flow" and create an "embedded data" block at the top of your flow that takes "X". You can also randomize your survey bassed on userID if you want to run a controlled experiment.
  2. Make a new wiki page on the Coursera course... go to Content - Course Pages - New Page. You can name it "Course Survey" or something like that. Click "HTML" in the corner, then paste in something like (with your unique Qualtrics survey link of course!)
<a href="#" id="custom-survey-link">You should be redirected momentarily - otherwise, click here to start the survey.</a>

    window.onload = function() {
       var userId = parseInt($('.course-topbar-nav-list-item:last a').data('user-id'));
       var url = "[***YOUR QUALTRICS SURVEY LINK HERE***]";
       var newUrl = url + "&X=" + userId;
       $('a#custom-survey-link').attr('href', newUrl);
       window.location = newUrl;
  • This code creates a hyperlink from your wiki page to your Qualtrics survey, and along the way it passes the student's unique userID number in the URL as "&X=[userID]". Qualtrics will catch this value and associate it with the student's survey response.</p>
  • Check the link by mouseover, and confirm that it's sending the userID. You're done! Now just make an announcement that directs people to the wiki page (not directly to Qualtrics!) to take the survey.

Survey as in-video quiz with user ID

This information below is a copy of Rene Kizilcec's MOOC Researcher Wiki at

This shows you how to place a Qualtrics survey into an in-video quiz on Coursera such that it passes the user ID.


  • Create a small Qualtrics survey (make sure it fits in the in-video quiz!). In the survey flow add an embedded field with the name "uid".
  • Create an in-video quiz. Set question type to "Radio" and template Id to "Continue only"
  • Paste the following script into the in-video quiz text box and make sure to change the YOUR_SURVEY_ID_HERE and COURSE_URL_CODE
<div id="survey"><iframe src="" width="780" height="470" seamless></iframe></div>
$.getJSON( "", function( data ) {
  $("#survey").html("<iframe src=\"" + data['id'] + "\" width=\"780\" height=\"470\" seamless></iframe>");