Skip to content

Instantly share code, notes, and snippets.

@prajwal-stha
Created July 24, 2017 09:56
Show Gist options
  • Select an option

  • Save prajwal-stha/9286e8d2704152c73281e8b653e95a68 to your computer and use it in GitHub Desktop.

Select an option

Save prajwal-stha/9286e8d2704152c73281e8b653e95a68 to your computer and use it in GitHub Desktop.
Global Code placed from ABTasty.
/*ECI 10 Standard R-pts (additional 4 cart-closer r-pts) : sportsfanfare.com*/
console.log('Hello');
$(document).ready(function() {
var ecitests = [];
for(i = 0; i < ABTasty.tests.length; i++) {
ecitests.push(ecitests[i]);
ecitests[i] = ABTasty.tests[i].datas.id;
var ECIdebug = false;
var ABeventTrack = function(elem, val, testID) {
$(elem).click(function(e) {
if(ECIdebug) {
e.preventDefault();
console.log(e);
}
try {
ABTastyClickTracking(val, null, testID);
console.log(val);
} catch(e) {
console.log("ABerror :" + val);
}
if(ECIdebug) console.log(val);
});
};
check_response_points = {
HP_page: function() {
if(window.location.href == "http://www.sportsfanfare.com/") {
try {
ABTastyClickTracking('(Standard) Views on Homepage', null, ecitests[i]);
console.log("Home Page Viewed");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
}
},
PP_page: function(testID) {
if($(".detail-main-img").length) {
try {
console.log("Product Page Viewed");
ABTastyClickTracking('(Standard) Views on Product Page', null, testID);
} catch(e) {
console.log("Product Page R-Pts");
}
try {
ABeventTrack('input#atc-button', '(Standard) Clicks on Add to Cart Buttons',testID);
} catch(err) {
console.log('Failed to load ABTasty javascript files.');
}
}
},
SW_pages: function() {
ABeventTrack('.category-left-box', '(Standard) Clicks on Left Nav',ecitests[i]);
ABeventTrack('.menu>li>a', '(Standard) Clicks on Top nav',ecitests[i]);
// Need to verify this line
ABeventTrack('.search_area input.serch-button, .search_area input.searchForm', '(Standard) Clicks on Internal Search',ecitests[i]);
},
CP_SubCP: function() {
if($(".category-main-box").length) {
try {
ABTastyClickTracking('(Standard) Views on Category Page', null, ecitests[i]);
console.log("Category page Viewed");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
}
if($(".listing-shop-box").length) {
try {
ABTastyClickTracking('(Standard) Views on Sub-category Page', null, ecitests[i]);
console.log("Sub-Category page Viewed");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
}
},
CartPage: function() {
if(location.href.match(/&sectionId=ysco\.cart/) || location.href.match(/cgi-bin\/wg-order\?theshorelinemarket/)) {
try {
ABTastyClickTracking('(Standard) Views on Cart Page', null, ecitests[i]);
console.log("(Standard) Views on Cart Page");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
ABeventTrack('#ys_pageBody > form > div.ys_pageActions.cb > ul > li.ys_first > a', '(Standard) Clicks on Keep Shopping' , ecitests[i]);
}
},
Shipbill_page: function() {
if(location.href.match(/&sectionId=ysco\.ship-bill/)) {
try {
ABTastyClickTracking('(Standard) Views on Shipping Billing Page', null, ecitests[i]);
console.log("(Standard) Views on Shipping Billing Page");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
}
},
cartcloser_popup: function(){
window.cod_3ab_cc_tracking = function(check_cc_trigger_val){ console.log(check_cc_trigger_val);
if(typeof check_cc_trigger_val !="undefined" && check_cc_trigger_val === 1){
try {
ABTastyClickTracking('Cart-Closer Triggered & Shown [control only]', null, ecitests[i]);
console.log("Cart-Closer Triggers");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
if($("#returntocart").length){
$("#returntocart").click(function(){
try {
ABTastyClickTracking('Cart-Closer Offer-Btn Clicks [control only]', null, ecitests[i]);
console.log("Cart-Closer Offer-Btn Clicks");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
});
}
$("#TB_cod_closeWindowButton,#TB_cod_overlay").click(function(){
try {
ABTastyClickTracking('Cart-Closer Close-Lightbox Clicks [control only]', null, ecitests[i]);
console.log("Cart-Closer Close-Lightbox Clicks");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
});
}else if(typeof check_cc_trigger_val !="undefined" && check_cc_trigger_val === 0){
try {
ABTastyClickTracking('Cart-Closer Triggered but Hidden [recipe B]', null, ecitests[i]);
console.log("Cart-Closer Triggered but Hidden");
} catch(exp) {
console.log('Failed to load ABTasty javascript files.');
}
}
};
if(typeof cod_3ab_cc == "undefined"){
cod_3ab_cc = 2;
}else{
console.log("test running");
}
},
init: function() {
ob = this;
ob.HP_page();
ob.PP_page(ecitests[i]);
ob.CP_SubCP();
ob.SW_pages();
ob.Shipbill_page();
ob.CartPage();
ob.cartcloser_popup();
}
}.init();
}
});
/*ECI 10 Standard R-pts (additional 2 ATC r-pts) : sportsfanfare.com*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment