How to Create a ClickBank Hoplink that Points to any URL you wish
As a long-time ClickBank Publisher and Affiliate I’ve often been frustrated by the fact that you simply have no control over where a “ClickBank Hop Link” points to.
Although there are scripts out today that do what I’m about to show you as part of a larger product (such as a complete affiliate tracker like EasyClickMate - which by the way is wonderful), why purchase a full-blown product if you only want to control your hoplinks?
So lets tame those out-of-control hoplinks shall we?
The following can be done with ASP just as easily but in this article we’ll focus on doing this through PHP.
So what am I going to do? I’m going to point visitors to any page on my site with just a few lines of code that only has to be implemented in 1 spot hence it should be relatively easy for anyone to implement this technique.
The kicker here is that before they land on the desired page, they will first be taken through the standard ClickBank Hoplink (http://AFFILIATE.PUBLISHER.hop.clickbank.net) so that the visitor is still tracked properly in order for the affiliate to get credit when a sale is made.
There are actually two ways to do this depending on how much control you want over where people can point your hoplink to.
- Give full control of what URL can be pointed to by putting the file and path directly in the url like so:
http://www.keywordexcavator.com/?goto=/lsi-seo-blog/2008/ how-an-lsi-search-engine-sees-your-articles-or-website/&aff=omalainet&tid=kwx_sac
This would redirect the user to http://www.keywordexcavator.com/lsi-seo-blog/2008/how-an-lsi-search-engine-sees- your-articles-or-website/- Or I can predefine the locations that can be directed to in my code (more on that later in the article) and the URL would look like:
http://www.keywordexcavator.com/?goto=blog&aff=omalainet2&tid=kwx_sac
Which takes people to my blog located at http://www.keywordexcavator.com/lsi-seo-blog/
Before we get started, here are a few practical applications you can use this technique for or what I’ve used it for so far;
- As an affiliate I can recall many instances where a publisher put up an awesome video promoting their product but the ClickBank affiliate link would only send my visitors to their sales page, not their video! Had the publisher used a simple script like mine I would have been able to link directly to the video while getting credit for any possible sales.
- I want affiliates promoting my KeyWord Excavator product to be able to point people directly to my Free Online Trial which is a major selling point. To achieve this, an affiliate would simply use this link: http://www.keywordexcavator.com/?goto=trial&aff=johndoe&tid=email1 - Go ahead and try it. As you can see you can even pass ClickBank’s own tracking ID (tid) as well so the affiliate can see where a sale originated from.
- I created a viral tool called Semantic Article Cleaner. I’ve made it so people can host my tool on their own website and make money by incorporating a clickbank affiliate link that promotes my KeyWord Excavator product, however, there’s also a link in there that points to my blog post containing additional information on the free tool.
If I were to link directly to the blog post and a person that clicks the link from my tool hosted at someone else’s blogs and ends up buying my product, the affiliate is not going to get any credit since the visitor didn’t come in through an affiliate link!
So we can resolve this by using my script to credit the affiliate and still pointing the visitor to the page we want him to link to which is my blog post.
The result is this link: http://www.keywordexcavator.com/?goto=blog_sac&aff=omalainet2&tid=kwx_sacb (again, try it!)
Note that the tid at the end of the link is optional and needs to comply with clickbank’s 8 character limit, it is purely meant for tracking and the value can be changed at the affiliate’s will.
So let me recap before we get down and dirty with the simple and short php code:
- Visitor clicks http://www.keywordexcavator.com/?goto=blog&aff=omalainet&tid=whatever
- The index.php on www.keywordexcavator.com sets a cookie or session that will expire in 15 seconds
- The index.php then redirects to the standard ClickBank hoplink using the affiliate ID and the tid: http://omalainet2.omalainet.hop.clickbank.net/?tid=whatever
- ClickBank sets a cookie on their domain and stores the visitor’s IP in their database to properly assign a sale to the affiliate if and when a sale is made.
- The clickbank hoplink sends the user back to my www.keywordexcavator.com/index.php (landing) page
- My tiny script sees there’s a cookie set that tells it to redirect to my blog (goto=blog). The cookie is deleted and the user is redirected.
Result: The person that clicked the link is cookied through the regular clickbank hoplink process yet does not end up on my landing page but lands on any page of my choosing.
The Code - Both Type of Redirects
This is the exact code I have on www.keywordexcavator.com (which is where my ClickBank account points to) at the time of writing:
if ($_GET["goto"]!=”" && $_GET["aff"]!=”") {
session_start();
$_SESSION["goto"]=$_GET["goto"];
header(”Location: http://”.$_GET["aff"].”.omalainet.hop.clickbank.net/?tid=”.$_GET["tid"]);
exit;
}
session_start();
if ($_SESSION["goto"]) {
if ($_SESSION["goto"]==”blog”) {
session_destroy();
header(”Location: http://www.keywordexcavator.com/lsi-seo-blog/”);
exit;
}
elseif ($_SESSION["goto"]==”trial”) {
session_destroy();
header(”Location: http://www.keywordexcavator.com/trial/”);
exit;
}
elseif ($_SESSION["goto"]==”tools_sac”) {
session_destroy();
header(”Location: http://www.keywordexcavator.com/lsi-seo-blog/semantic-article-cleaner/”);
exit;
}
elseif ($_SESSION["goto"]==”blog_sac”) {
session_destroy();
header(”Location: http://www.keywordexcavator.com/lsi-seo-blog/2008/how-an-lsi-search-engine-sees-your-articles-or-website/”);
exit;
}
else {
session_destroy();
header(”Location: http://www.keywordexcavator.com”.$_SESSION["goto"]);
exit;
}
}
There you have it.
This is the code that allows you to predefine a few ‘tags’ and point them to a certain page within your site (or even an external page if you wanted).
If a predefined ‘tag’ is not found the script will try to read the ‘goto’ variable directly and redirect to that subpage.
If you don’t like the idea of your affiliates having 100% control of what page their link points to you can remove the last bit of code that reads else { … }
So this code allows you to use:
http://www.yoursite.com/clickbank-landing-page.php?goto=/your-blog/&aff=johndoe&tid=blog
to link to:
http://www.yoursite.com/your-blog/
While still sending the visitor through the ClickBank affiliate hoplink.
And also a pre-defined link in the code:
http://www.yoursite.com/clickbank-landing-page.php?goto=blog&aff=johndoe&tid=blog
to link to:
http://www.yoursite.com/what-ever-subpage-you-predefined-in-code
That’s all there is to it folks!
Of course there are ways to expand on this code and if there’s enough demand I might do so in the near future. Think of adding tracking, a database, etc.
Please don’t hesitate to post any questions you have in the comment section below, I will read it and I will respond to it and help you in any way I can.
Tags: ClickBank, ClickBank Hoplink, Custom Hoplink, Custom Redirect, EasyClickMate, Redirect Script