|
Javascript code to extract cbf parameter from location url and modify payment links to include the extracted cbf parameterContentsIntroduction
When you create an upsell flow for Clickbank, you will find a small checkbox 'I will be passing the
This is where the IMHO, the easiest way to achieve that is through Javascript. It is pretty trivial to implement. It took me about 15 minutes to implement it but it could have been much faster if I did found an example on the Internet. There was none so I thought it would be a good idea to fill that gap, help others (and get some income from ads...)
Using the codeIt is very simple. Here are the steps:
Note that it could be trivial to modify the code for someone determined to not use jQuery but I'll leave that as an exercise to my most motivated readers...
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script type="text/javascript">
function gup( name, url ) {
if (!url) url = location.href;
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^]*)";
var regex = new RegExp( regexS );
var results = regex.exec( url );
return results == null ? null : results[1];
}
jQuery(function($) {
result = gup('cbf', null );
if (result) {
$('.paylink').each(function(i,obj) {
obj.href += "&cbf=" + result;
});
}
});
</script>
As a little but useful sidenote, note that the code should ideally be placed just before you close the Finally, you have to go through all your payment link on your page and change the following <a id="accept1" href="http://2.juicingoli.pay.clickbank.net/?cbur=a"> to <a class="paylink" id="accept1" href="http://2.juicingoli.pay.clickbank.net/?cbur=a"> An exampleOne way to test it, it to go to my front-end product page and buy all my products. ConclusionI hope this has been helpful to you. There are several things you can do to thank me. The best way would be to buy my stuff and in case you don't need my wonderful products right now in your life that would be greatly appreciated if you take few seconds to tweet, like and share this article by using the social media buttons found on this page. History
|