Place your message here

Your Guide to Professional
Web Site Design and Development

Web Development
HTML Codes
Javascript Snippets
216 Safe Colors
Web Directory
Web Resources
Internet Channels

Web Development: Business, Advertising, Internet Marketing, Promotion and Web Site Design

| Web Development | HTML Codes | HTML Tips | Javascript Snippets | 216 Safe Colors | Symbols | Recommendations |

Are You a ClickBank Affiliate? Here's How to Link Directly to the Product

By William Bontrager

The normal ClickBank system of product sales and affiliate referral links are addressed in this article. Some of the system's problems are identified. An easily implemented, workable solution is presented.

You'll find:

  1. An overview description of the normal system, for those unfamiliar with ClickBank.
  2. A list of three drawbacks to the normal system of linking.
  3. A solution to the problem.
  4. How the solution works.
  5. How to implement the solution.
  6. A method of testing the implementation.

Our Master Series of CGI programs is sold through ClickBank. Many sales are the result of affiliate referrals. Example ClickBank affiliate links in this article will be actual, working links so you can test them as you go along.

Normal Linking System Overview

ClickBank is a service where merchants can offer their products for sale. ClickBank has affiliates who can earn referral commissions selling those products.

ClickBank merchants control the amount of commission paid for their products. And ClickBank affiliates can refer their site visitors (or ezine readers) to the products/merchants of their choice.

Each ClickBank merchant and affiliate has a unique account nickname. The nickname is how ClickBank tracks who is owed what. ClickBank does all the bookkeeping and pays its affiliates and merchants on a regular basis.

(If you are not a ClickBank affiliate and want your own nickname, URL takes you directly to the sign-up form.)

This is what a normal ClickBank affiliate link looks like (replace XXXXX with your own ClickBank nickname):

When the above link is clicked, the browser is taken to ClickBank where a cookie with the merchant and affiliate nicknames are set (for credit in case of a sale), and then immediately redirected to the Master Series' referral landing page.

It's fast. The browser arrives at the landing page within a second, or thereabouts, but can be a bit longer if network traffic is congested or ClickBank's servers are slow.

The term "referral landing page" needs a bit of explaining: ClickBank merchants have a control panel where, among other things, they specify their "Homepage URL." This Homepage URL is where all referrals end up at (where they land) when the normal ClickBank affiliate link is clicked. Because the term "homepage" is easily confused with other definitions, we're using "referral landing page" or just "landing page" in this article.

Three Drawbacks

A problem with the normal affiliate linking system is these three drawbacks:

  1. Drawback for ClickBank affiliates:

    Others who are also ClickBank affiliates can easily substitute your nickname for theirs whenever they are ready to buy. All they have to do is copy your affiliate link, paste it into the browser's address bar, substitute their nickname for yours in the URL, and then go buy the product. Not only will they earn a commission from the transaction, they also make sure you don't.

  2. Drawback for both ClickBank affiliates and ClickBank merchants:

    If the merchant has more than one product, each with it's own product page, the referral may be required to click another link or two before finding the right product page. That's because the referral is redirected to the one and only referral landing page when clicking on an affiliate link. Scrolling through a list of products to find the right link may be too much trouble for someone with only a weak interest in the product anyway.

  3. Problem for ClickBank merchants:

    The usual method of linking does nothing to boost site ranking in search engines.

A Solution

The problem can be solved with simple, easy to implement, copy and paste JavaScript. It solves each of the three drawbacks listed above:

  1. Other ClickBank affiliates don't see a normal ClickBank link to take advantage of.
  2. The referral goes directly to the product page, before interest wanes searching for the right link.
  3. The merchant's site is now in position to count in search engine link popularity algorithms.

ClickBank affiliates, this is for you

See the "How It Works" section below for an understanding of how this solution still lets you get paid the referral commissions you are due.

After merchants implement the solution, you can link directly to product pages without publishing your normal ClickBank affiliate link. The solution is already implemented at the Master Series site, so we'll use one of its products for working examples.

The example links are to Master Form (replace XXXXX with your own ClickBank nickname):

You'll notice that the link is the normal product page URL followed by a ? or # character and your ClickBank nickname.

Because index.shtml is the default page for the /form/ directory, the file name may actually be omitted:

(Note the / character before the ? or # character when the web page file name is omitted. Some browser software becomes confused without that / character.)

ClickBank merchants, this is for you

The JavaScript is free to use. Implementation is copy and paste (see the "Implementation" section below, following "How It Works").

One of the beauties of this system is that ClickBank affiliates do not need to also register with you. Thus, you don't lose ClickBank affiliates who are reticent about giving out their email address or who prefer to link to some of the many other ClickBank merchants who don't have what can be seen as gratuitous requirements.

With this system, you are not adding requirements. Instead, you are making it more attractive for ClickBank affiliates to send referrals your way.

How It Works

When the referral comes to the product page, the referral's browser goes through three hops -- to ClickBank, to the landing page, and back to the original product page. Here are more details:

  1. The JavaScript on the product page takes a look at the URL used to arrive at the page. If the URL contains a ? or # character, everything following that character is assumed to be a ClickBank affiliate nickname.

    If the URL does not contain a ? or a # character, the browser just stays where it's at. But if it does contain one of those characters, the JavaScript stores a cookie in the referral's browser with information about which product page was the original destination. Then, it constructs a normal ClickBank affiliate link and redirects the browser to it.
  2. The browser arrives at ClickBank, which stores the affiliate and merchant nicknames in the browser as a cookie. The browser is immediately redirected to the merchant's referral landing page.
  3. The JavaScript at the landing page looks for an "original destination" cookie. If found, the browser is redirected back to the product page it originally came from.

It's fast. The browser returns to the product page within a second, or thereabouts, but can be a bit longer if network traffic is congested, if your server is slow, or if ClickBank's servers are slow.

The referral was sent to the exact product page, yet ClickBank was able to cookie the information required so the affiliate can get paid.


There are two sets of JavaScript code:

  1. One set for your referral landing page, the web page at the "Homepage URL" as specified in your ClickBank account control panel.
  2. Another set for each of your product pages, and other pages you think affiliates might want to link to.

Copy the JavaScript code from the page at and paste it into your pages.

For the referral landing page

The JavaScript for the referral landing page requires one customization. You need to specify a cookie name.

The cookie name can be any sequence of alphanumeric characters. It should be different from cookie names you're using for other things on your site.

The place to customize is clearly marked in the JavaScript. When you've specified a cookie name in the JavaScript, paste the code into the HEAD area of your landing page's source code. Paste the JavaScript above other JavaScript, if you can. The higher in the source code that the JavaScript is located, the sooner it can run and redirect the referral's browser.

For the product pages

The JavaScript for your product pages requires two customizations, the same cookie name you specified for the other JavaScript and your ClickBank account nickname. The places to customize the JavaScript are clearly marked.

Once the JavaScript for the product pages has been customized, paste the code into the HEAD area. The same JavaScript can be pasted into each of your product pages and also into the source code of other pages affiliates can link to.

Again, the higher in the source code that the JavaScript is located, the faster it can load and the sooner it can run.

That's all there's to it :)


It's important to test your installation.

To do so, use a browser where you can control the cookies.

Set your browser to to ask your permission before accepting cookies. Now, type an affiliate URL into your browser -- a URL to one of your products with ? or # and an affiliate code appended.

When the browser arrives at the affiliate URL, it should ask you to set a cookie. Say "yes."

Once you say "yes," your browser will redirect to ClickBank, where another cookie will want permission to be set -- which would be ClickBank's tracking cookie.

After you say "yes" again, your browser will redirect to your referral landing page and immediately return to the product page that was your original destination.

When your browser returns to the product page, the # or ? character and the affiliate code will no longer be in the address bar.

Okay, now set your browser so it no longer asks permission before accepting cookies. Type the same affiliate URL into your browser as you did before. This time, notice how fast the whole process really is.

Pretty nifty, huh?

Will Bontrager

About the Author:

William Bontrager Programmer/Publisher, "WillMaster Possibilities" ezine

Are you looking for top quality scripts? Visit Willmaster and check out his highly acclaimed Master Series scripts. Some free, some for a fee.