Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Adding url parameters to study link

Hi,

I am trying to embed a study created with lab.js and hosted on our server with JATOS into Qualtrics. I need to send information from the Qualtrics survey to the study and wanted to do this via url parameters. The problem is that something deletes the added parameters from the url, e.g. the url ".../jatos/publix/56/start?batchId=56&generalMultiple&paramA=123&paramB=456" turns into something like ".../jatos/publix/56/72/start?srid=336" when called from Qualtrics (or manually in the browser). The parameters are gone. I also tried other worker types url - same problem. Does anyone have any idea how to fix this?

Thanks!

Comments

  • JATOS puts all query parameters into jatos.urlQueryParameters that you can use in your JavaScript.

    So if your URL is ".../jatos/publix/56/start?batchId=56&generalMultiple&paramA=123&paramB=456" you can get the parameters via jatos.urlQueryParameters.paramA and jatos.urlQueryParameters.paramB .

    Best,

    Kristian

  • Hi Kristian,

    thank you for your swift reply. This worked immediately. The problem was actually in my lab.js script that I tried to call the query parameters with this.state.url.paramA. This call only worked if the url parameters stayed in the url. Replacing this call with jatos.urlQueryParameters.paramA as you suggested did the trick.

    Thank you!

    Jasmin

  • Hi @Snow,

    could you tell me where in your lab.js script/study you put the 'jatos.urlQueryParameters' call? Somehow it is not saved in my results...

    And do you happen to redirect your participants back to Qualtrics?

    I'm trying to do that with formr, which should be similar. I would like to simply put the redirect URL in the box in JATOS, but it doesn't seem to work with concatenated strings (I need to feed the url parameter back). Do you have any idea where in the lab.js script exactly I should put one of the options mentioned here: http://www.jatos.org/Use-Prolific.html?

    Thanks,

    Lea

  • Hi everyone,

    I am struggling with a similar issue with directing and redirecting to an external survey-page.

    I am currently setting up a study in which the participants fill in a survey on an external site (Questback/EFS) and will be directed to tasks on JATOS between questionnaires. The tasks were created with OSWeb.

    To direct and redirect users to external pages, Questback uses URL GET parameters. These are unique for each participant and serve as an identifier during a survey run.

    I have the same issue as @Snow mentioned above: The parameters are not displayed in the URL anymore once the participant is directed to JATOS (and I guess therefore not stored) and the redirect to Questback does not work. (Using the 'End Redirect URL'-Box in JATOS with a placeholder for the parameter value, the questionnaire can be reached but the participant cannot be identified and thus cannot continue with the survey run.)

    I tried to use the information provided by @kri but I am having issues with how and where to modify the JavaScript. I guess that for OSWeb this would be the 'jatos.js' file, but I have too little experience with coding in JavaScript to be able to modify the script correctly.

    As I unterstood it, I need to get the paramterer somehow (as described above using jatos.urlQueryParameters.paramA). But do I also need to implement something to then add the unique parameter value to the URL as well? Would I use the function jatos.endStudyAndRedirect for this?

    Any help would be highly appreciated! 🙂🙏

    Elena
  • krikri
    edited January 2021

    Hi Elena,

    As I unterstood it, I need to get the paramterer somehow (as described above using jatos.urlQueryParameters.paramA). But do I also need to implement something to then add the unique parameter value to the URL as well? Would I use the function jatos.endStudyAndRedirect for this?

    This is what I would do, yes. You cannot use the  'End Redirect URL'-Box in JATOS since your URL has to be dynamically generated. Your experiment sounds like it roughly has the following layout:

    1. some survey with Questback
    2. redirect to a JATOS study with a General Single/Multiple link while adding a Questback identifier to the URL as a query parameter, e.g. https://my-jatos-domain/publix/123/start?batchId=234&generalSingle&questbackId=12345789  (I made up the name of the Questback parameter - I don't know how Questback is naming them)
    3. When the JATOS study is finished use jatos.endStudyAndRedirect to redirect to Questback. And here you have to generate the URL you want to redirect to and use the Questback identifier that you can get via jatos.urlQueryParameters.questbackId (use the same name as the query parameter as in 2.). I don't know how the URL schema is in Questback but it could look like this: jatos.endStudyAndRedirect("https://questback-domain/somepath/foo?questbackId=" + jatos.urlQueryParameters.questbackId);
    4. some other survey with Questback
    5. redirect again to a JATOS study (probably a different one than before)

    ...

    But remember this jatos.endStudyAndRedirect is only available since JATOS version 3.5.1. Before one had to use jatos.endStudyAjax (http://www.jatos.org/jatos.js-Reference.html#jatosendstudyajax) in combination with window.location.href.

    Alternatively you can always do everything with JATOS including the surveys.

    Best,

    Kristian

  • hi,

    I have the same problem, so I use the jatos.urlqueryparameters code for retrieving an ID from qualtrics, but the ID that I try to retrieve from the URL is not saved in the Jatos results. When I check, during running the study in Jatos, if I can retrieve the jatos.urlqueryparameters in my browser window, I can weirdly find the right ID. So how is it possible Jatos doesn't save the ID in the results (the space {} stays blank (url: {}). What is the code you guys used in your lab.js script? thank you in advance

    Kind regards

    Mrockster

  • Hi Mrockster,

    Since this seems to be more an issue with lab.js you can also ask in their forum.

    Best,

    Kristian

Sign In or Register to comment.