<!DOCTYPE html>
<html><head><title>What is a “query string”?</title></head><body>
<b>What is a “query string”?</b><br />
<br />
A “query string” is one of several methods of passing data from one web page to another. You’ve probably seen URLs that look like this:<br />
<br />
<code>http://www.calendar.com<strong><span style="color:#000000;">?</span></strong>day=25&month=1&year=2018</code><br />
<br />
That URL contains two parts, separated by the “<code>?</code>” character. The part before the “<code>?</code>” mark is the <em>link</em> and the part after the “<code>?</code>” mark is <em>data</em> being passed to the link.<br />
<br />
In effect, the URL above says to go to the website <code>www.calendar.com</code> and pass the data<br />
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td valign="top"> </td>
<td> </td>
<td>day = 25<br />
month = 1<br />
year = 2018</td>
</tr>
</tbody>
</table>
<br />
Who knows what <code>calendar.com</code> is going to do with that data, but it’s reasonable to assume that it has something to do with the date “January 25, 2018.”<br />
<br />
When you look at the URL in this example, the query string is introduced by the “<code>?</code>” mark, followed by the actual query string which is made up of <code><em>name=value</em></code> data pairs, each separated by the “<code>&</code>” character:<br />
<br />
<code>http://www.calendar.com<strong><span style="color:#000000;">?</span><span style="color:#008000;">day=25</span><span style="color:#000000;">&</span><span style="color:#008000;">month=1</span><span style="color:#000000;">&</span><span style="color:#008000;">year=2018</span></strong></code><br />
<br />
The “<code>&</code>” character is commonly pronounced “and” in computer programming languages, so you can loosely think of that query string like this:<br />
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td valign="top"> </td>
<td> </td>
<td><strong>?</strong> <em>(pass the following data:)</em><br />
<strong>day = 25</strong>, and<br />
<strong>month = 1</strong>, and<br />
<strong>year = 2018</strong></td>
</tr>
</tbody>
</table>
<br />
In this example, each of these <code><em>name=value</em></code> pairs shows numerical values, but values can contain numbers, characters, and symbols as well. The <strong>month</strong> value could just as easily have been either of these:<br />
<br />
<code>month=jan<br />
month=[January]</code><br />
<br />
It’s really up to the target website to determine what the data means and how you need to pass it in.<br />
<br />
Query strings are used in several places in ClickMagick. You’ll find them in tracking pixels, Postback URLs, affiliate network integration, and the Funnel Builder.<br />
<br />
You may need to edit query strings at times, or add a new <code><em>name=value</em></code> parameter. For example, let’s assume you have a URL and you need to add this ClickMagick integration parameter:<br />
<br />
<code>s1=[clickid]</code><br />
<br />
If the URL doesn’t have a query string yet (meaning there’s no “<code>?</code>” mark yet), you’ll need to <em>create</em> the query string by adding a “<code>?</code>” mark followed by the new parameter:<br />
<br />
<code>http://www.website.com<span style="color:#000000;"><strong>?</strong></span><span style="color:#008000;"><strong>s1=[clickid]</strong></span></code><br />
<br />
On the other hand, if the URL already <em>has</em> a query string (meaning there’s already a “<code>?</code>” mark), you would simply add the new parameter to the end using the “<code>&</code>” character:<br />
<br />
<code>http://www.website.com<strong>?</strong>id=475<span style="color:#000000;"><strong>&</strong></span><span style="color:#008000;"><strong>s1=[clickid]</strong></span></code><br />
<br />
You can search the web for a much more thorough discussion of query strings, but this should get you through 97% of the situations you’ll ever run across.<br />
<br />
<br />
<strong>Encoded Query Strings</strong><br />
<br />
One thing you’re sure to run into is “encoded” query strings. These are query strings where some characters are replaced with a more “machine friendly” form. For example, the space character will typically be replaced with <code>%20</code>, colons with <code>%3A</code>, and slashes with <code>%2F</code>. Don’t be surprised if you see <code>http://</code> encoded as<code> http%3A%2F%2F</code>. <strong><a href="http://www.w3schools.com/tags/ref_urlencode.asp" target="_blank">Check out W3Schools.com’s complete list of URL encodings</a></strong>.<br />
<br />
HTML has a different way of encoding characters using named “entities.” For example, the “<code>&</code>” character itself will often be replaced with <code>&<span style="font-size:1px;"> </span>amp;</code>. This creates some unusual looking query strings, especially when you paste an otherwise normal looking link into a Page Builder and you see your <code><em>name=value</em></code> pairs separated by <code>&<span style="font-size: 1px;"> </span>amp;</code> entities when you view your page source. You can find an extensive list of these <strong><a href="http://www.w3schools.com/html/html_entities.asp" target="_blank">HTML entities at W3Schools.com</a></strong>.<br />
<br />
You won’t need to worry about encoded query strings in ClickMagick, but at least you’ll know what those <code>%##</code> and <code>&<i>entity</i>;</code> encodings are when you do see them.<br />
<br />
<br />
<strong>Value-less Parameters</strong><br />
<br />
Another thing you’ll see are query strings where the parameters don’t have any values, such as:<br />
<br />
<code>http://www.calendar.com?day=&month=&year=</code><br />
<br />
Parameters without values are perfectly fine. It just means they aren’t specified. For this <code>www.calendar.com</code> example, this might simply mean “display today” since an actual date is not specified. Using value-less parameters is quite common, so don’t let it confuse you if you see them.<br />
<br />
<div class="faq-tip"><b>Tip:</b> If you want to pass a query string from a tracking link to its Primary URL, you can use the <code>[query_string]</code> token. See the section on <strong>Passthrough Tokens</strong> in this FAQ:<br />
<table border="0" cellpadding="0" cellspacing="0" style="box-sizing: border-box; border-collapse: collapse; border-spacing: 0px; max-width: 100%;">
<tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;">
<td style="box-sizing: border-box; width: 20px;"><a href="/user/faqs.cgi?answer=41"><img height="20" src="//cdn.clickmagick.com/images/user/faqpage.gif" style="box-sizing: border-box; border: 0px; vertical-align: middle;" width="17" /></a></td>
<td style="box-sizing: border-box;"> </td>
<td style="box-sizing: border-box;"><b><a href="/user/faqs.cgi?answer=41"> What data can I pass to the URLs I promote?</a></b></td>
</tr>
</tbody>
</table>
</div>
<div class="faq-note"><b>Note:</b> For a more complete description of query strings, take a look at this Wikepedia entry:<br />
<table border="0" cellpadding="0" cellspacing="0" style="box-sizing: border-box; border-collapse: collapse; border-spacing: 0px; max-width: 100%;">
<tbody style="box-sizing: border-box;">
<tr style="box-sizing: border-box;">
<td style="box-sizing: border-box; width: 20px;"><a href="https://en.wikipedia.org/wiki/Query_string" target="_blank"><img height="20" src="//cdn.clickmagick.com/images/user/faqpage.gif" style="box-sizing: border-box; border: 0px; vertical-align: middle;" width="17" /></a></td>
<td style="box-sizing: border-box;"> </td>
<td style="box-sizing: border-box;"><b><a href="https://en.wikipedia.org/wiki/Query_string" target="_blank">History and Use of Query Strings</a></b></td>
</tr>
</tbody>
</table>
</div>
</body></html>