Skip to content

Commit 003330f

Browse files
Innovative-GauravKocharGaurav Kochar
andauthored
Fixed issue of Shareasale not working without use total as amount enabled (#798)
* Fixed issue of Shareasale not working without use total as amount enabled * bump shareasale version --------- Co-authored-by: Gaurav Kochar <gaurav.kochar@segment.com>
1 parent c851772 commit 003330f

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

integrations/shareasale/lib/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ ShareASale.prototype.orderCompleted = function(track) {
3636
var orderId = track.orderId();
3737
var isRepeat = track.proxy('properties.repeat');
3838
var subtotal = (track.subtotal() || 0).toFixed(2);
39+
var total= (track.total() || 0).toFixed(2)
3940
var orderTotal =
4041
this.options.useTotalAsAmount && track.total()
41-
? track.total().toFixed(2)
42-
: subtotal.toFixed(2);
42+
? total
43+
: subtotal;
4344
var products = track.products();
4445
var currency = track.currency() || this.options.currency;
4546
var coupon = track.coupon() || '';

integrations/shareasale/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-shareasale",
33
"description": "The Shareasale analytics.js integration.",
4-
"version": "2.2.3",
4+
"version": "2.2.4",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",

integrations/shareasale/test/index.test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ describe('ShareASale', function() {
6969
subtotal: 42,
7070
shipping: 10,
7171
tax: 3.5,
72-
total: 55.5,
72+
total: 55,
7373
revenue: 15
7474
});
7575
analytics.loaded(
76-
'<img src="https://shareasale.com/sale.cfm?amount=55.50&tracking=123&transtype=sale&merchantID=bonobos&skulist=&quantitylist=&pricelist=&currency=USD&couponcode=">'
76+
'<img src="https://shareasale.com/sale.cfm?amount=55.00&tracking=123&transtype=sale&merchantID=bonobos&skulist=&quantitylist=&pricelist=&currency=USD&couponcode=">'
7777
);
7878
});
7979

@@ -93,10 +93,10 @@ describe('ShareASale', function() {
9393
orderId: 123,
9494
shipping: 10,
9595
tax: 3.5,
96-
total: 55.5
96+
total: 55
9797
});
9898
analytics.loaded(
99-
'<img src="https://shareasale.com/sale.cfm?amount=42.00&tracking=123&transtype=sale&merchantID=bonobos&skulist=&quantitylist=&pricelist=&currency=USD&couponcode=">'
99+
'<img src="https://shareasale.com/sale.cfm?amount=41.50&tracking=123&transtype=sale&merchantID=bonobos&skulist=&quantitylist=&pricelist=&currency=USD&couponcode=">'
100100
);
101101
});
102102

@@ -148,7 +148,7 @@ describe('ShareASale', function() {
148148
total: 55.5
149149
});
150150
analytics.loaded(
151-
'<img src="https://shareasale.com/sale.cfm?amount=42.00&tracking=123&transtype=sale&merchantID=bonobos&skulist=&quantitylist=&pricelist=&currency=USD&couponcode=">'
151+
'<img src="https://shareasale.com/sale.cfm?amount=47.00&tracking=123&transtype=sale&merchantID=bonobos&skulist=&quantitylist=&pricelist=&currency=USD&couponcode=">'
152152
);
153153
});
154154

0 commit comments

Comments
 (0)