{"id":61,"date":"2016-06-03T23:58:33","date_gmt":"2016-06-03T22:58:33","guid":{"rendered":"https:\/\/gavincarpenter.co.uk\/adops\/?p=61"},"modified":"2016-06-03T23:59:07","modified_gmt":"2016-06-03T22:59:07","slug":"query-string-queries","status":"publish","type":"post","link":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/2016\/06\/03\/query-string-queries\/","title":{"rendered":"Query String Queries"},"content":{"rendered":"<p>Website addresses or URLs are complicated things that are actually made up of many parts.<\/p>\n<p>This is a URL with all it&#8217;s different bits colour coded:<\/p>\n<p><strong><span style=\"color: #ff0000;\">https<\/span>:\/\/<span style=\"color: #ff9900;\">www.client.com<\/span>\/<span style=\"color: #ffcc00;\">shop\/offer<\/span><span style=\"color: #339966;\">?source=display&amp;campaign=summer<\/span><span style=\"color: #0000ff;\">#section2<\/span><\/strong><\/p>\n<p><!--more--><\/p>\n<p><em>There are actually more parts than this that could be used but these are pretty much the only ones you are likely to see when running ad campaigns.<\/em><\/p>\n<ul>\n<li><span style=\"color: #ff0000;\"><strong>Scheme<\/strong> <\/span>= this will just be either &#8220;http&#8221; or (hopefully nowadays) &#8220;https&#8221;. Other things can be used like &#8220;mailto&#8221; or &#8220;ftp&#8221; but they&#8217;re not common enough to go into here.<\/li>\n<li><span style=\"color: #ff9900;\"><strong>Host<\/strong> <\/span>= this can be thought of as just the website in general, remember that the &#8220;www.&#8221; may be required or may not, both are actually valid.<\/li>\n<li><span style=\"color: #ffcc00;\"><strong>Path<\/strong> <\/span>= this is basically the different folders you navigate through to get to the page in question.<\/li>\n<li><span style=\"color: #339966;\"><strong>Query String<\/strong><\/span> = now this is the most important part for use in AdOps. The query string is a collection of what are called &#8220;name value pairs&#8221;. In this example you have one with the name &#8220;source&#8221; and its value &#8220;display&#8221;, another called &#8220;campaign&#8221; with the value &#8220;summer&#8221;. A query string must always start with a question mark (there should only be one question mark in a URL with some rare exceptions) and have it&#8217;s different pairs separated by ampersands (&amp;).<\/li>\n<li><span style=\"color: #0000ff;\"><strong>Fragment<\/strong> <\/span>= call this a hashtag and I may have to slap you (while we&#8217;re at it these things {} are called &#8220;braces&#8221; not &#8220;squiggly brackets!). These are sometimes referred to as anchor tags and they cause the webpage to jump down to or show a particular section. If you look at most FAQ type pages where the questions are all at the top and clicking on one of them makes the page jump down to the right answer, these work by using these fragments in the links.<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>A common mistake I see with URLs my team gets sent to traffic is this:<\/p>\n<ul>\n<li><strong>URL Sent:<\/strong> https:\/\/www.client.com\/offers?code=12345<\/li>\n<li>They know that they need to add &#8220;?source=display&#8221; to every URL they are given.<\/li>\n<li><strong>Resulting URL:<\/strong> https:\/\/www.client.com\/offers<span style=\"color: #ff0000;\">?<\/span>code=12345<span style=\"color: #ff0000;\">?<\/span>source=display<\/li>\n<li>This URL has two question marks in which won&#8217;t work, technically the value of &#8220;code&#8221; is all of &#8220;12345<span style=\"color: #000000;\">?<\/span>source=display&#8221;<\/li>\n<li>The extra tracking should be added on separated by an ampersand to keep the format correct.<\/li>\n<li><strong>Correct URL:<\/strong> https:\/\/www.client.com\/offers?code=12345<span style=\"color: #339966;\">&amp;<\/span>source=display<\/li>\n<\/ul>\n<p>Another mistake is related to those fragments:<\/p>\n<ul>\n<li><strong>URL Sent:<\/strong> https:\/\/www.client.com\/offers#section2<\/li>\n<li>Again they try to add &#8220;?source=display&#8221; to the URL<\/li>\n<li><strong>Resulting URL:<\/strong> https:\/\/www.client.com\/offers<span style=\"color: #ff0000;\">#section2<\/span>?source=display<\/li>\n<li>The page doesn&#8217;t change to the right section correctly, this is because the fragment is not at the end where it should be.<\/li>\n<li><strong>Correct URL:<\/strong> https:\/\/www.client.com\/offers?source=display<span style=\"color: #339966;\">#section2<\/span><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Website addresses or URLs are complicated things that are actually made up of many parts. This is a URL with all it&#8217;s different bits colour coded: https:\/\/www.client.com\/shop\/offer?source=display&amp;campaign=summer#section2<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Query String Queries","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[9],"tags":[14,19,13],"class_list":["post-61","post","type-post","status-publish","format-standard","hentry","category-general-discussion","tag-common-mistakes","tag-query-strings","tag-urls"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p79kpO-Z","_links":{"self":[{"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/posts\/61","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/comments?post=61"}],"version-history":[{"count":2,"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/posts\/61\/revisions"}],"predecessor-version":[{"id":97,"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/posts\/61\/revisions\/97"}],"wp:attachment":[{"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/media?parent=61"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/categories?post=61"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gavincarpenter.co.uk\/adops\/index.php\/wp-json\/wp\/v2\/tags?post=61"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}