Guide To Query Strings

A URL is made up of lots of parts.

What is a Query String?

One of the key characters that can exist in a URL is the ?, that basically ends the URL itself and starts adding additional data you want to send to the site. This data is called a Query String. So we start with a URL like this:

and we break off the query string, we're left with: the URL: and the Query String: ?sid=f119025b-4731-f802-f2a3-8c679fb463e7&sscid=1234&__hstc=184377529.dfa03b903a2582f9f325d3718a98d1e1.1530802752542.1553198335808.1553273543904.265&__hssc=184377529.8.1553273543904&__hsfp=2386364020&_ga=2.98520474.488882776.1553099511-41566484.1528380992

Salesforce and Rustic Pathways’ Enrollment System

Now, we need to talk about Salesforce and how RP's Enrollment system works. Regardless of where you are on the site, the Enrollment URL is always the same: 

What changes is the data that comes in the Query String.

Query Strings are Key/Value pairs separated by & symbols, so our Query String has the following Key/Value Pairs:

The format for this is key=value

  • sid=f119025b-4731-f802-f2a3-8c679fb463e7
  • sscid=1234
  • __hstc=184377529.dfa03b903a2582f9f325d3718a98d1e1.1530802752542.1553198335808.1553273543904.265
  • __hssc=184377529.8.1553273543904
  • __hsfp=2386364020
  • _ga=2.98520474.488882776.1553099511-41566484.1528380992

Lots of stuff going on, right?

The beauty here is that as long as you don't have key collisions (where you have two key/value pairs with the same key, think "Name = Laura" and "Name = Gurpreet". How do you know what the name actually is?), things are pretty simple.

There's only one URL, but there are lots of things that LOOK at the URL, so the querystring becomes this place where anybody can store stuff, but that stuff isn't necessarily important to everyone.

If we all share a common drawer, I might throw in some scissors, and you might throw in some a lens cleaning kit, and I don't wear glasses, so the lens cleaning kit doesn't matter to me.

The QueryString works kind of the same way. Our Enrollment App doesn't only cares about the key sid. Everything else we'll just ignore. If we're debugging something related to enrollment, we're going to make sure all of the different things our app does affects the sid key and value properly. The rest of the stuff doesn't matter.