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: ?name=Danny

The wording in bold font is what you would add to the end of your run URL in order to ensure that the variable name is defined as "Danny." Then, you just need to make sure your program uses this variable, with plenty of references like Howdy, {name}!

Adding a single numerical variable 🔗

The process for adding a numerical variable to your program is pretty similar. Here's an example: ?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'll 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: ?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"]

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: ?beatles=John&beatles=Paul&beatles=George&beatles=Ringo