| Line 44... |
Line 44... |
| 44 |
};
|
44 |
};
|
| 45 |
function fetchLivePrice(obj){
|
45 |
function fetchLivePrice(obj){
|
| 46 |
ga('send', 'event', 'liveprice', 'fetch', $(obj).data('bundle_id'));
|
46 |
ga('send', 'event', 'liveprice', 'fetch', $(obj).data('bundle_id'));
|
| 47 |
var properties = {};
|
47 |
var properties = {};
|
| 48 |
properties.bundle_id = String($(obj).data('bundle_id'));
|
48 |
properties.bundle_id = String($(obj).data('bundle_id'));
|
| 49 |
pma.send('products','livescore','fetch',me,properties);
|
49 |
pma.send('products','livesprice','fetch',me,properties);
|
| 50 |
var that = obj;
|
50 |
var that = obj;
|
| 51 |
var inStock = false;
|
51 |
var inStock = false;
|
| 52 |
var req = $.ajax({
|
52 |
var req = $.ajax({
|
| 53 |
url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
|
53 |
url: '/store_products/getliveprice/'+$(that).data('bundle_id')+'/'+$(that).data('id'),
|
| 54 |
// Tell jQuery we're expecting JSONP
|
54 |
// Tell jQuery we're expecting JSONP
|
| Line 114... |
Line 114... |
| 114 |
if(!response.products[0].available_price){
|
114 |
if(!response.products[0].available_price){
|
| 115 |
// outOfStockCount++;
|
115 |
// outOfStockCount++;
|
| 116 |
// $(that).parent().parent().remove();
|
116 |
// $(that).parent().parent().remove();
|
| 117 |
var btn = $("<a class='tryagainforliveprice btn btn-xs btn-warning' title='Try Again'>Try Again</a>");
|
117 |
var btn = $("<a class='tryagainforliveprice btn btn-xs btn-warning' title='Try Again'>Try Again</a>");
|
| 118 |
$(that).html(btn);
|
118 |
$(that).html(btn);
|
| 119 |
ga('send', 'event', 'liveprice', 'failed', response.products[0]._id);
|
119 |
// ga('send', 'event', 'liveprice', 'failed', response.products[0]._id);
|
| - |
|
120 |
// console.log('failed for '+ response);
|
| 120 |
properties = {};
|
121 |
// properties = {};
|
| 121 |
properties.sku = String(response.products[0]._id);
|
122 |
// properties.sku = String(response.products[0]._id);
|
| 122 |
pma.send('products','liveprice','failed',me,properties);
|
123 |
// pma.send('products','liveprice','failed',me,properties);
|
| 123 |
}
|
124 |
}
|
| 124 |
} else{
|
125 |
} else{
|
| 125 |
// outOfStockCount++;
|
126 |
// outOfStockCount++;
|
| 126 |
// $(that).parent().parent().remove();
|
127 |
// $(that).parent().parent().remove();
|
| 127 |
var btn = $("<a class='tryagainforliveprice btn btn-xs btn-warning' title='Try Again'>Try Again</a>");
|
128 |
var btn = $("<a class='tryagainforliveprice btn btn-xs btn-warning' title='Try Again'>Try Again</a>");
|
| Line 663... |
Line 664... |
| 663 |
return $(this).data("brandid") == brands[i];
|
664 |
return $(this).data("brandid") == brands[i];
|
| 664 |
}).removeClass('hidden').find('.filterbrand',0).trigger( "click" );
|
665 |
}).removeClass('hidden').find('.filterbrand',0).trigger( "click" );
|
| 665 |
}
|
666 |
}
|
| 666 |
}
|
667 |
}
|
| 667 |
}
|
668 |
}
|
| - |
|
669 |
function showPosition(position) {
|
| - |
|
670 |
setCookie('latitude',position.coords.latitude,1,false);
|
| - |
|
671 |
setCookie('longitude',position.coords.longitude,1,false);
|
| - |
|
672 |
}
|
| 668 |
$(function () {
|
673 |
$(function () {
|
| 669 |
var poid = 'popovertrigger';
|
674 |
var poid = 'popovertrigger';
|
| 670 |
var cname = 'popover-count-'+me+'-'+poid;
|
675 |
var cname = 'popover-count-'+me+'-'+poid;
|
| 671 |
var cookieval = getCookie(cname,0);
|
676 |
var cookieval = getCookie(cname,0);
|
| 672 |
$('#dropdownMenu1').on('click',function(){
|
677 |
$('#dropdownMenu1').on('click',function(){
|
| Line 697... |
Line 702... |
| 697 |
showpopover(poid);
|
702 |
showpopover(poid);
|
| 698 |
}
|
703 |
}
|
| 699 |
}
|
704 |
}
|
| 700 |
}*/
|
705 |
}*/
|
| 701 |
ga('send', 'event', 'popover', me, cookieval);
|
706 |
ga('send', 'event', 'popover', me, cookieval);
|
| - |
|
707 |
if (navigator.geolocation) {
|
| - |
|
708 |
navigator.geolocation.getCurrentPosition(showPosition);
|
| - |
|
709 |
}
|
| 702 |
});
|
710 |
});
|
| 703 |
function showpopover(id){
|
711 |
function showpopover(id){
|
| 704 |
$('[data-toggle="popover"]#'+id).popover({'html':true});
|
712 |
$('[data-toggle="popover"]#'+id).popover({'html':true});
|
| 705 |
$('[data-toggle="popover"]#'+id).trigger('click');
|
713 |
$('[data-toggle="popover"]#'+id).trigger('click');
|
| 706 |
}
|
714 |
}
|
| Line 812... |
Line 820... |
| 812 |
this.apiurl = "http://45.33.50.227:8081/";
|
820 |
this.apiurl = "http://45.33.50.227:8081/";
|
| 813 |
// this.apiurl = "http://127.0.0.1:8081/";
|
821 |
// this.apiurl = "http://127.0.0.1:8081/";
|
| 814 |
this.endpoints = {'identify':'identify','profile':'profile','track':'track'};
|
822 |
this.endpoints = {'identify':'identify','profile':'profile','track':'track'};
|
| 815 |
|
823 |
|
| 816 |
this.send = function (category,action,label,user_id,properties) {
|
824 |
this.send = function (category,action,label,user_id,properties) {
|
| - |
|
825 |
if(!properties){
|
| - |
|
826 |
properties = {};
|
| - |
|
827 |
}
|
| - |
|
828 |
properties.location = window.location.href;
|
| - |
|
829 |
// properties.appCodeName = navigator.appCodeName;
|
| - |
|
830 |
// properties.appName = navigator.appName;
|
| - |
|
831 |
// properties.appVersion = navigator.appVersion;
|
| - |
|
832 |
properties.cookieEnabled = String(navigator.cookieEnabled);
|
| - |
|
833 |
properties.platform = navigator.platform;
|
| - |
|
834 |
properties.userAgent = navigator.userAgent;
|
| - |
|
835 |
properties.ip = ip;
|
| - |
|
836 |
if (navigator.geolocation) {
|
| - |
|
837 |
properties.latitude = getCookie('latitude');
|
| - |
|
838 |
properties.longitude = getCookie('longitude');
|
| - |
|
839 |
}
|
| - |
|
840 |
properties.screenHeight = String(screen.height);
|
| - |
|
841 |
properties.screenWidth = String(screen.width);
|
| - |
|
842 |
// console.log(properties);
|
| 817 |
$.ajax({
|
843 |
$.ajax({
|
| 818 |
url: this.apiurl + this.endpoints.track,
|
844 |
url: this.apiurl + this.endpoints.track,
|
| 819 |
data: {'category':category,'action':action,'label':label,'user_id':user_id,'properties':cassandraMAP.stringify(properties)},
|
845 |
data: {'category':category,'action':action,'label':label,'user_id':user_id,'properties':cassandraMAP.stringify(properties)},
|
| 820 |
// Tell jQuery we're expecting JSONP
|
846 |
// Tell jQuery we're expecting JSONP
|
| 821 |
dataType: "json",
|
847 |
dataType: "json",
|