URL Parameters

New!

Lesson Length -

2:00

Use URL Parameters To Inject Data Into Your Experiences
Close Video

Resources

Let's Use URL Parameters

URL parameters, also known also as “query strings”, “URL query parameters” or “URL params” are elements added to the end of the URL and they are used all over the web.

For example, let's say we had an e-commerce site at xyzcorp.com.

If a user visited our store at this URL shown above, our site's code could sort and categorize the products shown to our user, using only the URL.

The question mark [?] signifies the start of params in a URL, and the ampersand [&] is the separator between our various parameter key/value pairs.

In this case, sort and category are our keys, and newest and widgets are our the values themselves.

URL Params In Judo

In Judo, we use URL Params to inject values into our experience by appending params to the end of the launch URL for our experience.

In our Judo Desktop app we can set up a test value for a URL param. This value will persist into the Judo mobile iOS and Android preview apps.

For example, you may recall our Fitness App Experience that we’ve been developing in our other Lessons.

In our Inspector Panel, if we click the Document Inspector icon at the top, that switches our panel on the right to now show our Document Inspector. Here is where we handle URL Parameters. Let’s add a new parameter, where the key is firstName, using no spaces of course. And for the value, here we enter a test value that we will preview in our design.

Watch this quick silent video to see how we did this:

Mapping a URL Params

To use a URL Param in our Experience, we simply type two curly braces, url. and we will see the auto-suggested values. From the example above, we would simply type {{url.fname}} to use the fname value we added in our Document Inspector.

This test value will also persist if you open this .judo file in the iOS & Android Preview Apps:

Using URL Params In Production

Once you have finalized the design of your experience, and you have tested the injection of URL Params with test values, you can upload the .judo file to your judo.app cloud account.

This will then give you two launch links to your experience:

  • Universal Link
  • Deep Link

You can use a URL Param onto the end of either of these links. The value you use will then inject into the experience.

An example might be a sports team that wants to inject a "gameweek" value into their experience. They would use a launch url like this:

In this example, anywhere in the experience that uses {{url.gameweek}} would have the value 2 injected.

Awesome! There are many ways we can use URL Parameters but that’s it for now, next up is User Info.

Was this lesson helpful?

Close
Close