From c7adf2d9a7d7410df57c94de9fca4b3209604eed Mon Sep 17 00:00:00 2001 From: Matt Caimi Date: Mon, 26 Jun 2023 13:24:44 -0400 Subject: [PATCH] CSR-1439 comment to describe lastNavPage setting --- src/router/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/router/index.js b/src/router/index.js index 3b09d7260..2663846ce 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -161,7 +161,11 @@ const router = createRouter({ //---------------------------------------------------------- Router Functions ---------------------------------------------------------- router.beforeEach(async (to, from, next) => { + // Set the lastNavigationPage to the current page name for accurate tracking of page navigations. + // Since beforeEach() can be triggered before navigation resolution, to.name may sometimes be "root". + // In such cases, getPageName() from the analyticsMixin is used to accurately get the current page name. router.lastNavigationPage = to.name == "root" ? analyticsMixin.methods.getPageName() : to.name; + next(); });