Use Query Strings Effectively
The query string (the stuff after the “?” in a URL) is a powerful tool for web measurement and data collection.
Because of the stateless nature of HTTP, many sites use query strings in their URLs to pass information from page to page or request to request. The query string is a specific portion of a URI that begins after the URI stem and a question mark (?), as shown in the following example:
http://www.mysite.com/page.htm?name=value |
Where www.mysite.com
is your
server DNS or (s-dns) name, page.htm
is your URI stem and name=value
is
your query string. The query string in this example contains one query
string, which is composed of a parameter, variable, or name=value
pair.
Within the structure of a query string, there may be multiple pairs, each consisting of a variable, followed by an equal sign (=) and then the data or value associated with each variable name. If there are multiple query string variables in your query string, they will be separated by an ampersand (&). Simply put, the query string is a sequence of name=value pairs separated by ampersands (&) as in:
?page=product%20view%20page%2Fprodid123&campaign=123
Query strings can be used to carry almost any type of data back to your web servers for a very wide range of purposes. Any query string parameters added to the URL typed into the address bar of the web browser will likely be captured and logged along with the rest of the URL by a responding web server. Finally, certain “unsafe” characters ...
Get Web Site Measurement Hacks now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.