Subversion Repositories SmartDukaan

Rev

Rev 10675 | Rev 10704 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 10675 Rev 10696
Line 491... Line 491...
491
      }
491
      }
492
    var paymentTitle = e.currentTarget.getAttribute('data-key');
492
    var paymentTitle = e.currentTarget.getAttribute('data-key');
493
    ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
493
    ga('send', 'event', 'Payment Option', 'Form Submission',paymentTitle);
494
  }
494
  }
495
}
495
}
-
 
496
var url;
-
 
497
 url = document.URL;
-
 
498
 if(url.indexOf('pay-success') != -1){
-
 
499
  if(orderConfirmation != undefined){
-
 
500
    debugger;
-
 
501
    ga('require', 'ecommerce', 'ecommerce.js');
-
 
502
    var orders = orderConfirmation['result']['orders'];
-
 
503
    for(i=0;i<orders.length;i++){
-
 
504
      debugger
-
 
505
      var amount = orders[i].totalAmount.replace(',','');
-
 
506
      amount = parseFloat(amount).toFixed(2);
-
 
507
      var orderId = orders[i].orderId;
-
 
508
      ga('ecommerce:addTransaction', {
-
 
509
        'id': orderId,                     // Transaction ID. Required.
-
 
510
        'affiliation': 'shop2020',   // Affiliation or store name.
-
 
511
        'revenue': amount,               // Grand Total.
-
 
512
        'shipping': '0',                  // Shipping.
-
 
513
        'tax': '0',                     // Tax.
-
 
514
        'city':"",
-
 
515
        'state':"",
-
 
516
        'country':"India"
-
 
517
      });
-
 
518
      ga('ecommerce:addItem', {
-
 
519
        'id': orderId,                     // Transaction ID. Required.
-
 
520
        'name': orders[i].itemName,    // Product name. Required.
-
 
521
        'sku': orders[i].itemName,                 // SKU/code.
-
 
522
        'category': 'Physical',         // Category or variation.
-
 
523
        'price': amount,                 // Unit price.
-
 
524
        'quantity': orders[i].quantity                   // Quantity.
-
 
525
      });
-
 
526
    }
-
 
527
    ga('ecommerce:send');
-
 
528
  }
-
 
529
 }