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;