Forum Discussion

JimOwen-f418d1f's avatar
JimOwen-f418d1f
Community Member
3 months ago

How to direct user via URL

I would like to create a project which either starts on a different slide or else populates a variable upon user entry, based on a URL.

The idea is to create multiple QR codes which send the user to the same course, but depending on the URL of the code, they get a slightly different experience. I don't want to create a separate course for each URL because the vast majority will be identical every time, and that will be a management headache as there may be up to a dozen of these.

Is there a way to do this using, for example, query parameters?

www.mystorylinecourse.com/story.html?myVar=1

www.mystorylinecourse.com/story.html?myVar=2

www.mystorylinecourse.com/story.html?myVar=3

etc?

  • JesseWu's avatar
    JesseWu
    Community Member

    What prevents you from streaming users to different scenes by selecting roles on the introductory page? 

    Introduction Scene, Select the role here and direct to assigned scenes -> Parallel Scene for role A/B/C -> Shared Ending and Completion Track

    All in the same project file.

  • You can create a dynamic URL for each course.
    Shown how to here.
    https://community.articulate.com/discussions/discuss/qr-code-and-shorturl-generation-in-storyline/1034621

    As for query parameters... yes you can use them. I actually did post about it but searching your own content in the new community is tough, so i do have trouble finding it.

    In my code library i found this snippet with which you can read query params.

    function getQueryVariable(variable)
    {
           var query = window.location.search.substring(1);
           var vars = query.split("&");
           for (var i=0;i<vars.length;i++) {
                   var pair = vars[i].split("=");
                   if(pair[0] == variable){return pair[1];}
           }
           return(false);
    }
    
    
    /*
    Example URL:
    http://www.example.com/index.php?id=1&image=awesome.jpg
    
    Calling getQueryVariable("id") – would return “1”.
    Calling getQueryVariable("image") – would return “awesome.jpg”.
    */