Skip to content

Instantly share code, notes, and snippets.

@cracell
Last active December 15, 2015 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cracell/5341923 to your computer and use it in GitHub Desktop.
Save cracell/5341923 to your computer and use it in GitHub Desktop.
The has offers direct link code from https://media.go2speed.org/assets/js/dl.js but patched to work asynchronously.
var hasoffers_aff_id = getUrlVars()["aff_id"];
var hasoffers_offer_id = getUrlVars()["offer_id"];
var hasoffers_source = getUrlVars()["source"];
var hasoffers_aff_sub = getUrlVars()["aff_sub"];
var hasoffers_aff_sub2 = getUrlVars()["aff_sub2"];
var hasoffers_aff_sub3 = getUrlVars()["aff_sub3"];
var hasoffers_aff_sub4 = getUrlVars()["aff_sub4"];
var hasoffers_aff_sub5 = getUrlVars()["aff_sub5"];
var hasoffers_aff_ref = getUrlVars()["aff_ref"];
if( ((typeof (hasoffers_aff_id) != "undefined" && hasoffers_aff_id !== undefined) || ( typeof (hasoffers_aff_ref) != "undefined" && hasoffers_aff_ref !== undefined )) && (typeof (hasoffers_offer_id) != "undefined" && hasoffers_offer_id !== undefined) ) {
var hasoffers_click = "";
if (typeof (hasoffers_aff_id) != "undefined" && hasoffers_aff_id !== undefined && IsNumeric(hasoffers_aff_id)) {
hasoffers_click = hasoffers_domain+"/aff_c?offer_id="+hasoffers_offer_id+"&aff_id="+hasoffers_aff_id;
}else if (typeof (hasoffers_aff_ref) != "undefined" && hasoffers_aff_ref !== undefined) {
hasoffers_click = hasoffers_domain+"/aff_c?offer_id="+hasoffers_offer_id+"&aff_ref="+hasoffers_aff_ref;
}
if(typeof (hasoffers_source) != "undefined" && hasoffers_source !== undefined ) {
hasoffers_click = hasoffers_click+"&source="+hasoffers_source;
}
if(typeof (hasoffers_aff_sub) != "undefined" && hasoffers_aff_sub !== undefined ) {
hasoffers_click = hasoffers_click+"&aff_sub="+hasoffers_aff_sub;
}
if(typeof (hasoffers_aff_sub2) != "undefined" && hasoffers_aff_sub2 !== undefined ) {
hasoffers_click = hasoffers_click+"&aff_sub2="+hasoffers_aff_sub2;
}
if(typeof (hasoffers_aff_sub3) != "undefined" && hasoffers_aff_sub3 !== undefined ) {
hasoffers_click = hasoffers_click+"&aff_sub3="+hasoffers_aff_sub3;
}
if(typeof (hasoffers_aff_sub4) != "undefined" && hasoffers_aff_sub4 !== undefined ) {
hasoffers_click = hasoffers_click+"&aff_sub4="+hasoffers_aff_sub4;
}
if(typeof (hasoffers_aff_sub5) != "undefined" && hasoffers_aff_sub5 !== undefined ) {
hasoffers_click = hasoffers_click+"&aff_sub5="+hasoffers_aff_sub5;
}
if(typeof (hasoffers_click) != "undefined" && hasoffers_click != "" ) {
img = document.createElement('img');
img.src = hasoffers_click;
img.width = "1";
img.height = "1";
img.border = "0";
document.body.appendChild(img);
}
}
function getUrlVars() {
var vars = {};
var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
vars[key] = value;
});
return vars;
}
function IsNumeric(input)
{
return (input - 0) == input && input.length > 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment