From 45481ba34c529a32b0735c65e69c5e990b19206b Mon Sep 17 00:00:00 2001 From: DerrickGHW Date: Wed, 21 Dec 2022 12:54:35 -0500 Subject: [PATCH 1/3] add shipping & payment events for logged-in flow --- .../cartridge/client/default/js/account.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js b/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js index db42531..0b818b0 100644 --- a/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js +++ b/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js @@ -86,6 +86,28 @@ function getAccountDetails(oAuthToken) { data: reqBody, success: function (data) { window.location.href = data.redirectUrl; + console.log(data.redirectUrl); + if (data.redirectUrl.includes('placeOrder')) { + // if the redirect url is placeOrder, all the user data are populated properly. + // Note that if the redirect url is a stage prior to place order, we don't have to + // fire any events because checkout.js will handle those + + // Fire the corresponding events + // shipping events + window.BoltAnalytics.checkoutStepComplete( + constants.EventShippingDetailsFullyEntered, + { loginStatus: 'logged-in' } + ); + window.BoltAnalytics.checkoutStepComplete( + constants.EventShippingMethodStepComplete + ); + + // payment events + window.BoltAnalytics.checkoutStepComplete(constants.EventPaymentMethodSelected); + window.BoltAnalytics.checkoutStepComplete( + constants.EventPaymentDetailsFullyEntered + ); + } }, error: function (jqXHR, error) { console.log(error); From ef7699cf82a6c2152bad1a834cb5cd500809d1d0 Mon Sep 17 00:00:00 2001 From: DerrickGHW Date: Wed, 21 Dec 2022 12:54:48 -0500 Subject: [PATCH 2/3] remove comment --- .../cartridge/client/default/js/account.js | 1 - 1 file changed, 1 deletion(-) diff --git a/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js b/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js index 0b818b0..c9445a6 100644 --- a/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js +++ b/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js @@ -86,7 +86,6 @@ function getAccountDetails(oAuthToken) { data: reqBody, success: function (data) { window.location.href = data.redirectUrl; - console.log(data.redirectUrl); if (data.redirectUrl.includes('placeOrder')) { // if the redirect url is placeOrder, all the user data are populated properly. // Note that if the redirect url is a stage prior to place order, we don't have to From 3437266620959644ebc894398b7227150b821ebb Mon Sep 17 00:00:00 2001 From: DerrickGHW Date: Wed, 21 Dec 2022 13:23:31 -0500 Subject: [PATCH 3/3] move account regonition event early --- .../cartridge/client/default/js/account.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js b/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js index c9445a6..fd44046 100644 --- a/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js +++ b/cartridges/int_bolt_embedded_sfra/cartridge/client/default/js/account.js @@ -136,6 +136,7 @@ exports.checkAccountAndFetchDetail = function () { method: 'GET', success(data) { if (data !== null) { + window.BoltAnalytics.checkoutStepComplete(constants.EventAccountRecognitionCheckPerformed, { hasBoltAccount: data.has_bolt_account, detectionMethod: 'email' }); if (data.has_bolt_account) { login(customerEmail); if ($accountCheckbox) { @@ -144,7 +145,6 @@ exports.checkAccountAndFetchDetail = function () { } else { $('.submit-customer').removeAttr('disabled'); // enable checkout button for non Bolt shopper } - window.BoltAnalytics.checkoutStepComplete(constants.EventAccountRecognitionCheckPerformed, { hasBoltAccount: data.has_bolt_account, detectionMethod: 'email' }); } }, error: function (jqXHR, error) {