Get URL Parameters
Jaap MurreIllustrates how to send subjects to a different webiste (e.g., a survey in Google Forms). Also shows how to decode any parameters sent from another site with your script (e.g., when using NeuroTask with a proprietary subject management system).
These functions are mainly added for convenience; the Javascript code can easily be found online.
On the basis of this example more complex functions can be developed that allow smooth integration with other web-based testing services and subject management systems.
If you are a registered user and signed in, you can here copy this script and its stimuli to your own account, where you can edit it and change it in any way you want.
It is absolutely free to register (no credit card info asked!). You can then instantly copy this experiment with one click and edit it, change its accompanying texts, its landing page, stimuli, etc. Invite your colleagues, friends, or students to check out your experiment. There is no limit on how many people can do your experiment, even with a free account.
The catch? There is no catch! Just keep in mind that with a free account, you cannot collect data. For teaching that is usually not a problem. For research, prepaid data collection (unlimited subjects) starts as low as €10.00 for a 10-day period.
/* The following two functions are now in the util library function getURLParameters(url) { url = url || location.search; var pars = {}; url.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(s,k,v) { pars[k]=v; } ); return pars; } function redirect(url,url_parameters_object) { var s = url, p = url_parameters_object ? $.param(url_parameters_object) : ""; s = p ? s + "?" + p : s; closesession(); // make sure all data has been saved to server window.location = s; } */ // Example URL from google var s = "https://www.google.nl/search?q=neurotask+scripting"; var obj = util.getURLParameters(s); // {q: 'neurotask'} console.log("URL Object: ",obj); text("Press spacebar to be redirected"); awaitkey(' '); util.redirect("https://www.google.nl/search",obj); //redirect to https://www.google.nl/search" with search parameters in obj
You can download the files as follows: Click on the file (link) and then right-click and choose Save as... from the menu. Some media files (e.g., sound) will have a download button for this purpose.