Get the dirt on those URLs!

“The addition of the query string to the base URL doesn’t change the way the page displays. When a user follows a link the browser requests the page from the server and ignores what follows the question mark (? i.e and sends the page as expected, adding the query string to its links as well. The question mark is used as a separator, and is not part of the query string.”

It’s hard to get dirty with “Clean URLs“, what was that he said?  Hey, we all know how important “SEO Friendly URLs” are for human readability and the search engine indexing process but for the sake of this topic I’m going to leave it at that, knowing this covers the general understanding.  So you’ve got these wonderful “Clean URLs” and everything is humming along just fine.  Then outta nowhere, the sales team wants to know if you can create a unique user experience scenario on a specific product detail page – what?  Big problem if you are dealing with guest accounts because you’ve got nothing to make any sort of connection, like you would for an account user, you know like a “$username“.  This is why I really like, almost love, the “Query String“, BIG Hugs here!  So a query string is part of the uniform resource locator (URL) containing data that doesn’t fit conveniently into a hierarchical path structure; that’s the part of the URL after the question mark (?).

Let’s describe a “unique user experience” where you can execute code based on URL parameters whose values are statically (absolute links) produced in a page’s URL; could also be set dynamically (string based URL object).  Using an absolute link even a clean URL is doable in this scenario because we are able to append the query string with whatever parameter value we see fit, making data analysis easier to understand when it comes time to report.  So here is my absolute link:  Yup that’s from my pretend, wink – wink, email campaign to drive awareness about moorescode’s e-commerce / digital consulting services; of course I want to know that users are arriving via the email channel group.  More importantly, I want to do something special for those users regardless of whether they’re logged in or not.  So here’s what I’m going to do, I’m going to display a time-sensitive coupon for a “Free e-commerce site evaluation” when they reply by email with the offer’s code.  What a great guy I must be, OK let’s stay focused here.

Here’s a simplified version of the code, no not from the offer – sheesh, now you’re just being silly…

<!DOCTYPE html>
<title>Show/Hide Content Based on the URL Parameter</title>
<script src=""></script>
            if ( == "?source=email") {
            else if ( != "?source=email") {
<div id="content">Email campaign content for a Free e-commerce site evaluation.</div>

In short, if the URLs query string is equal to (==) “?source=email” show “#content”, conversely if the URLs query string is not equal (!=) to “?source=email” hide “#content”, personalization just got simple right?  It’s pretty awesome and neatly packaged, all that’s left to do is to set up some “Goals” and “Event Tracking” in analytics and you’re all set.  Once you know the rules you can start breaking them so it’s possible to keep it clean but don’t worry about getting dirty every once in a while, those URLs might not be SEO Friendly but they sure are CX Personable.


David Moores @ NYC

At moorescode, our objectives are to build “first in class” digital experiences that focus on perfecting the customers’ journey.  Our strengths lie in digital analytics, metric components and the implementation of data tracking methods for mining interpretation.  These mechanisms provide the necessary insight to ensure your company’s branding message maintains a unified voice across all touch-points.  With our advanced knowledge of web server deployment, database management systems, and server-side scripting languages we’ve earned a reputation as experts in the web technology sector.

Leave a Reply