Qualtrics linking

From Solowiki
Revision as of 15:38, 22 June 2020 by Anneloes (talk | contribs)
Jump to navigation Jump to search

Studies hosted on JATOS, Gorilla or Pavlovia can be integrated with Qualtrics in a way which allows information exchange in both directions: from the studies to Qualtrics, and vice versa. Both methods use [Query Strings https://en.wikipedia.org/wiki/Query_string] and typically involve redirecting participants to an online study after they have completed a Qualtrics survey; and/or redirecting participants to a Qualtrics survey after they have completed an online study.

Linking to Qualtrics

OSWeb/JATOS Implementation

Follow the steps below to link from an OSWeb task to Qualtrics. We also provided the following demo task in OpenSesame: JatosToQualtrics.osexp

Assuming you already have a survey in Qualtrics, edit it and go to ‘Distributions’ and click ‘Get single reusable link’.

Step 1: OpenSesame

In OpenSesame, add an inline_javascript object (Figure 1) to the end of your experiment. If you don’t have the OSWeb section in the OpenSesame toolbar, please upgrade your OpenSesame to the latest version.

Figure 1: The inline_javascript object.

In the inline_javascript object, paste the Qualtrics link and store it in a JavaScript variable:

1 // example
2 var surveyUrl = 'https://leidenuniv.eu.qualtrics.com/jfe/form/SV_1SrURH8xI3jHbYV';

If you also want to send some variables from OpenSesame to Qualtrics you can add these to the link:

1 // example: sending variables to Qualtrics in Url
2 vars.favoriteColor = 'blue'; 
3 surveyUrl += '?favoriteColor=' + vars.favoriteColor; // first argument starts with '?' 
4 vars.subjectNr = 1; 
5 surveyUrl += '&subjectNr=' + vars.subjectNr; // next arguments start with '&'

Note: It is also possible to send JATOS identifiers (e.g. studyId, workerId, batchId) to Qualtrics, see the example task for a demonstration.

Now instruct OpenSesame to open the link:

1 window.open(surveyUrl);

To save your experiment. Go to Tools -> OSWeb -> Export experiment as JATOS study

Step 2: JATOS

  1. Log in to JATOS.
  2. Go to Import Study.
  3. Import your experiment ZIP file (e.g. MyExperiment.osexp.zip).
  4. Go to your Study and then to ‘Worker & Batch Manager’ (green button).
  5. Assuming you want a unique link for each participant that is usable only once:
    1. ‘Get Worker Links’ -> Select ‘Personal Single’ -> ‘Next’ -> Specify the amount of links needed -> Next
    2. Save these links somewhere to give to your participants and for testing.

Note: You can also make multiple batches and you can use other types of workers (e.g. anonymous users, multiple runs per user, and so on.)

Step 3: Qualtrics

The final step in this process in receiving the data in Qualtrics. Data obtained from URLs is called ‘Embedded Data’ in Qualtrics. First you have to specify which information is in the URL:

  1. Edit your Survey
  2. Go to Survey Flow
  3. Add the names of the variables you send in the Url (e.g. subjectNr and favoriteColor in the example above). These names are case sensitive.
  4. Click options to specify the variable type (e.g. Number for subjectNr and Text for favoriteColor). Also see the image below.
Figure 2: Configuring embedded data in Qualtrics.

Now how can you use this information in your survey?

Information from embedded data can be used in survey questions. To make it easy to use this data in this way, Qualtrics has the ‘Piped Text’ feature. More information about Piped Text is explained in the Qualtrics documentation.

Figure 3: Example of using the piped text corresponding to the information we obtained from the OpenSesame demo task.

Step 4: Testing

Open one of the JATOS Worker Links and check the experiment, the redirection to Qualtrics, and the information exchange.

Linking from Qualtrics

OSWeb/JATOS Implementation

Follow the steps below to redirect from a Qualtrics Survey (after completion) to an OSWeb experiment on JATOS and (optionally) to send information from the survey to the experiment. We also provided a demo experiment in OpenSesame that receives survey answers from Qualtrics: QualtricsToJatos.osexp

Step 1: OpenSesame

Suppose your Qualtrics Survey has two Questions:

1) What is your favorite food? 2) What is your favorite animal?

To receive this information, you also have to make two JavaScript variables in OpenSesame, e.g. ‘favoriteFood’ and ‘favoriteAnimal’, and obtain their values:

1 // obtain information from JATOS Url 
2 var favoriteFood = jatos.urlQueryParameters.favoriteFood; 
3 // Set the variable value to 'unknown' if the Url does not contain a value for this variable 
4 vars.favoriteFood = favoriteFood ? favoriteFood : "unknown"; 
5 var favoriteAnimal = jatos.urlQueryParameters.favoriteAnimal; 
6 vars.favoriteAnimal = favoriteAnimal ? favoriteAnimal : "unknown";

Note: You can now show these variables in your experiment (e.g. on a Feedback item) or log them in the experiment log using the Logger item. See the demo experiment for a demonstration with both the Feedback display and the variable logging.

To save your experiment go to Tools -> OSWeb -> Experiment as JATOS study

Step 2: JATOS

  1. Log in to your JATOS server.
  2. Click ‘Import Study’ and select your OpenSesame ZIP file.
  3. Go the Study in JATOS and then to ‘Workers & Batch Manager’
  4. Assuming you want a general (non-personal) re-usable link:
    1. Select ‘General Multiple’ and click ‘Next’.
    2. Copy the link to and empty NotePad document.

Step 3: Qualtrics

Now the final but also most essential step, correctly redirecting the participant from your survey to your JATOS study. Qualtrics has the option to redirect participants to custom webpages.

When editing your survey, you can find this option under ‘Survey Options’. In the ‘Survey Options’ dialog, in the section ‘Termination Options’, toggle ‘Redirect to a full URL, ex. "https://www.qualtrics.com"’. This is where you specify the link to the JATOS task AND the information you want to send to JATOS.

Redirect link construction:

Open your NotePad document with the JATOS link, e.g.:

1 https://cortex.jatos.org/publix/68/start?batchId=68&generalMultiple

And add a line below similar to the following for each variable (as you defined in step 1):

1 &favoriteFood=${q://QID6/ChoiceGroup/SelectedChoices}

In this example 'favoriteFood' is the name of the variable and '${q://QID6/ChoiceGroup/SelectedChoices}' is the piped text segment that corresponds to the selected answer to Question 6 (QID6). You can look up the Question ID in the Survey.

Finally, combine all lines into one long link, e.g.:

1 https://cortex.jatos.org/publix/68/start?batchId=68&generalMultiple&favoriteFood=${q://QID6/ChoiceGroup/SelectedChoices}&favoriteAnimal=${q://QID8/ChoiceGroup/SelectedChoices}

Copy and paste this link to the ‘Redirect URL’ box in the Survey Options dialog of your survey.

Step 4: Testing

  1. Open your survey and submit your answers.
  2. Check the automatic redirection to the OSWeb task and complete the task
  3. Check the exchange of variables (e.g. by checking the log file in the JATOS Results)