What is the correct syntax for query strings?

From Market Ruler Help
Revision as of 17:55, 29 September 2009 by Admin (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The query string format is an internet standard. With all standards, the implementation of the standard is up to the browser vendors.

We have taken great pains to make our software as compatible as possible with all browsers, however, some best practices will ensure the highest level of compatibility.

A URL (Uniform Resource Locator) is the web address you see so commonly in your web browser's address bar. It typically looks like:

http://www.example.com/some-page.asp?articleid=232

If you don't understand URLs, please learn more about URLs before continuing.

Let's cover the best practices when generating query strings:

Landings to just your domain name

We recommend using

http://www.example.com/?crcat=test&crsource=test&crkw=buy-a-lot

The ordering is:

  1. Your domain name
  2. Make sure it is followed with a slash and question mark "/?"
  3. Landing Parameters

The slash followed by the question mark after the domain name is important, for best compatibility with browsers.

Landings to a page within your domain name with no query string

We recommend using

http://www.example.com/mypage.html?crcat=test&crsource=test&crkw=buy-a-lot

The ordering is:

  1. Your domain name
  2. A slash "/"
  3. Your page path (e.g. mypage.html)
  4. A question mark "?"
  5. Landing Parameters

The question mark after the page path is important, and also: no slash after the page name.

Placing a slash after your page path will most likely cause an error for the user.

Landings to a page within your domain name with a query string

We recommend using

http://www.example.com/catalog.asp?itemid=232&template=fresh&crcat=ppc&crsource=google&crkw=buy-a-lot

The suffix is:

  1. "&"
  2. Landing Parameters

The ampersand after the page and query string with no additional question marks or slashes after the existing query string.

Placing a slash or question mark after your existing URL will most likely cause an error for the user.

In summary:

  • A URL should always contain "http://"
  • A URL should always have a slash "/" after the domain name
  • A URL which contains a page on your site should NEVER have a "/" after it (e.g. "foo.html/")
  • A URL should always have a single question mark in it "?"
  • URL Query String parameters should be separated by the ampersand "&"

Now, playing around, the following landings are all correct:

http://www.some-domain.com/index.html?&crsource=google
http://www.some-domain.com/?&&&&crsource=google

The following landings will most likely cause problems or not work:

http://www.some-domain.com/catalog.cgi?pid=232?crsource=google
http://www.some-domain.com?crsource=google

If you have specific question about query strings, contact us.