Sharing a Run URL with Custom-Loaded Variables🔗

URL parameters, custom attributes, query string, passing arguments, passing variables, sending values, http

Imagine this scenario. You have a GuidedTrack program that you want to share with the world, but you want to give slightly different versions of it to different groups of people. No problem. You don't need to create multiple GuidedTrack programs in order to accomplish this goal, you just need to tweak the run URL a little bit.

Adding a single text variable🔗

Let's say your teenage daughter wants to start dating. You're sort of okay with that, but you want each date to first take an extensive survey that includes criminal history questions and compatibility scales to ensure they're a good fit for your little poodlesticks. You want to personalize it a little by adding a variable that uses their name every now and then so they don't think you're weird. Rather than include their name as a variable in the program (which you'd then have to change for the next person who wants to date your daughter), you can add it to the URL like this:

https://www.guidedtrack.com/programs/uniqueprogramID/run?boyName=Danny

Notice that the URL above is the run URL of the program (https://www.guidedtrack.com/programs/uniqueprogramID/run) followed by the character "?" to indicate that you are going to set the value of a variable, then the variable name (in this case boysName), the "=" character, and whatever value you want to give to that variable for that particular run. Then, you just need to make sure your program uses this variable, with plenty of references like Howdy, {boyName}!

Adding a single numerical variable🔗

The process for adding a numerical variable to your program is pretty similar. Here's an example:

https://www.guidedtrack.com/programs/uniqueprogramID/run?x=4

You can define x as any number that you want, including decimal and negative numbers. Just don't use any commas.

Keep in mind, though, that values in URLs are always interpreted as text strings. You can force them to numbers using code like:

>> x = x * 1

By multiplying the variable by 1, you ensure it becomes numerical. If you forgot to perform this step of converting the variable from text to number, then you may get unexpected behavior and/or errors when attempting to perform calculations with those variables!

Adding multiple variables🔗

Suppose you wanted to do the equivalent of this in the URL:

>> x = 3
>> y = 4
>> z = 5

To do this through the URL, you'd put an ampersand (&) between each variable definition:

https://www.guidedtrack.com/programs/uniqueprogramID/run?x=3&y=4&z=5

Adding a collection🔗

Suppose you wanted to do the equivalent of the following command, but through the URL:

>> beatles = ["John", "Paul", "George", "Ringo"]

As long as there are no duplicate values in the collection, you just have to add each item individually, repeating the name of the variable, while separating each item in the collection using an ampersand. Like this:

https://www.guidedtrack.com/programs/uniqueprogramID/run?beatles=John&beatles=Paul&beatles=George&beatles=Ringo

What if the collection has duplicate values?

>> myMathGradesSoFar = [98, 89, 90, 92, 89]

In this case, you can add a single text variable that represents your collection with the values separated by a delimiter:

>> myMathGradesSoFarAsTextVar = "98|89|90|92|89"

Therefore, the URL would look something like this:

https://www.guidedtrack.com/programs/uniqueprogramID/run?myMathGradesSoFarAsTextVar=98|89|90|92|89

Inside your program, you can convert this variable to a collection using the split function:

>> myMathGradesSoFar = myMathGradesSoFarAsTextVar.split("|")

Next: