Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
maxLevel1

...

 e

As we saw in Different tasks for different user groups in Chapter 7, we may have separate tests set up for separate user groups. We can then use several methods from Chapter 9 - Recruiting participants to direct each participant to the right test.

...

Here’s how it looks in a web ad’s explanation page:

 

Here’s Here is an vanilla HTML page with the JavaScript code for the link. This should work in all modern browsersincluded. Feel free to customise this as needed:

Code Block
languagejs
~code that auto-adjusts to an arbitrary # of supplied URLs

 

Here is an vanilla web page with the code included. Feel free to customise this as needed:

...

xml
<!DOCTYPE html>
<head>
  <script>
    <!--
    var links = new Array()

    links[0] = "http://google.com"
    links[1] = "http://bing.com"
    links[2] = "http://duckduckgo.com"

    function getRandomLink() {
      window.location = links[Math.floor(Math.random() * links.length)]
    }
    //-->
  </script>
</head>

<body>
  <a href="javascript:getRandomLink()">Do the study now</a>
</body>
</html>

 

This works well in an explanation page on the website (that the web ad would direct to), but it may not work reliably in email invitations because some email clients may block JavaScript in incoming messages. ~check this

As a workaround, we could make the email invitation go to a web page on our site that shows a “One moment please…” message, does the random-test-by-code selection, then automatically redirects to the corresponding test address.

...