Using the static site
To use the static website in your research, you will direct participants to the assessment you want them to take.
Specifying the assessment
Directly visiting the static site main web page shows nothing because the entry web page is expecting a URL parameter to tell it what assessment to run. Remember, a m2c2kit static site can host many assessments and many versions of those assessments.
🌐 What is a URL parameter?
A URL specifies the location of a resource on the internet.
URL parameters are additional information passed to the webpage. They are appended to the end of the URL, after a ?
. Multiple parameters can be used by separating them with &
.
For example, to set parameters called name
and school
, the URL would be: http://www.example.com?name=m2c2kit&school=PennState
What if you want to set a parameter to a value that includes spaces, or even a &
or =
character? To do that, you must encode the value (sometimes called URL-encoding, URI-encoding, or percent encoding).
For example, to set the parameter school
to franklin & marshall
, we would pass in the URL-encoded value, which is franklin%20%26%20marshall
. The URL would be http://www.example.com?name=m2c2kit&school=franklin%20%26%20marshall
To run a particular assessment, set the URL parameter called assessment
to the package name and version of an assessment you specified in the site configuration.
For example, consider a configuration file that looked like this:
assessments: [
{
name: "@m2c2kit/assessment-symbol-search",
versions: ">=0.8.19",
},
{
name: "@m2c2kit/assessment-grid-memory",
versions: ">=0.8.19"
}
]
To run version 0.8.19 of Symbol Search, the browser address would be:
http://127.0.0.1:8080/index.html?assessment=@m2c2kit/assessment-symbol-search@0.8.19
To run version 0.8.19 of Grid Memory, the browser address would be:
http://127.0.0.1:8080/index.html?assessment=@m2c2kit/assessment-grid-memory@0.8.19
Still confused? If you get a blank page, open the developer console. There will be some helpful messages about what assessments are in the static site and how to run them.
Use cases
A URL with the appropriate assessment
parameter is how you will direct participants to specific assessments, such as:
- Participants complete a survey in Qualtrics or RedCap, and then you direct them to a m2c2kit assessment on the static site.
- In an ecological momentary assessment (EMA) approach, you send participants text messages at carefully chosen times. The messages contain a URL to a m2c2kit assessment on the static site.
Individual-level parameter customization
In the site configuration, the parameters
property allowed customization of assessment parameters. However, you may want parameters customizations specific to a group of participants or a single participant.
If assessment parameters are added to the URL, it will override the parameters that were set in the site configuration.
Imagine we had two groups of participants. Group A has an abbreviated protocol (only 6 trials). Group B has the full protocol (12 trials). You could send the following URLs:
- Group A receives
http://127.0.0.1:8080/index.html?assessment=@m2c2kit/assessment-symbol-search@0.8.19&number_of_trials=6
- Group B receives
http://127.0.0.1:8080/index.html?assessment=@m2c2kit/assessment-symbol-search@0.8.19&number_of_trials=12
(of course, in a real study, the static site would not be running on your local machine at http://127.0.0.1:8080
, but you get the idea!)