From cdade68cea19188660dbb48747bc3ab7afac1516 Mon Sep 17 00:00:00 2001 From: srthurman Date: Thu, 7 Sep 2017 13:56:14 -0700 Subject: [PATCH] Support "Completed Order" Support the legacy "Completed Order" event name. Some customers still use that, and this change will allow them to use Optimizely as intended without changing their code base. --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 2f33201..b2fb1bd 100644 --- a/lib/index.js +++ b/lib/index.js @@ -92,9 +92,9 @@ Optimizely.prototype.track = function(track) { // Optimizely expects revenue only passed through Order Completed events if (eventProperties.revenue && opts.sendRevenueOnlyForOrderCompleted) { - if (track.event() === 'Order Completed') { + if (track.event() === 'Order Completed' || track.event() === 'Completed Order') { eventProperties.revenue = Math.round(eventProperties.revenue * 100); - } else if (track.event() !== 'Order Completed') { + } else { delete eventProperties.revenue; } // This is legacy Segment-Optimizely behavior,