From 0afa4d815cb41b8d6afc5a5945da689e9bedfc79 Mon Sep 17 00:00:00 2001 From: Katie Date: Fri, 12 Aug 2022 10:16:37 -0400 Subject: [PATCH] CSR-514 Add PageEntry trigger, move running experiments in router to a private function --- src/router/index.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 27f726e17..d14a692f0 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -37,11 +37,7 @@ const routes = [ return next(false); } - baseMixin.methods.dispatchStoreAction(storeActions.RUN_EXPERIMENTS_FOR_TRIGGER, { - userId: getDeviceIdValue(), - triggerEvent: experimentTriggers.SITE_ENTRY, - triggerValue: applicationConfig.SITE_ENTRY_TRIGGER_VALUE - }) + runExperiments(to.query.fmgPage); // If the saved session has timed out, clear the session, execute 404 logic. if (getFunnelCookie() !== null && !isSavedSessionStillActive()) { @@ -272,4 +268,19 @@ function arePagePrerequisitesValid(component) { return component.default.methods.arePagePrerequisitesValid(); } +// Run SiteEntry and PageEntry triggers for experiments +function runExperiments(nextPage) { + baseMixin.methods.dispatchStoreAction(storeActions.RUN_EXPERIMENTS_FOR_TRIGGER, { + userId: getDeviceIdValue(), + triggerEvent: experimentTriggers.SITE_ENTRY, + triggerValue: applicationConfig.SITE_ENTRY_TRIGGER_VALUE + }) + + baseMixin.methods.dispatchStoreAction(storeActions.RUN_EXPERIMENTS_FOR_TRIGGER, { + userId: getDeviceIdValue(), + triggerEvent: experimentTriggers.PAGE_ENTRY, + triggerValue: nextPage + }) +} + export default router;