CASH-183 | Update the store when exposure is logged
This prevents erroneous logs being created in EXPERIMENT_LOG by log-custom-event If the store still showed not exposed after logExposure was called, following log-custom-events still sent the experiment as not exposed
This commit is contained in:
parent
a7a901d8da
commit
31719e5ef6
3 changed files with 16 additions and 3 deletions
|
|
@ -54,7 +54,7 @@ const storeActions = {
|
|||
GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems",
|
||||
|
||||
// Analytics
|
||||
LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure",
|
||||
LOG_EXPERIMENT_EXPOSURE_AND_UPDATE_STORE: "logExperimentExposureAndUpdateStore",
|
||||
LOG_PAGE_VIEW: "logPageView",
|
||||
LOG_CUSTOM_EVENT: "logCustomEvent",
|
||||
INITIALIZE_SESSION: "initializeSession",
|
||||
|
|
|
|||
|
|
@ -187,7 +187,7 @@ export default {
|
|||
if (experimentForLogging !== undefined) {
|
||||
// Log experiment exposure
|
||||
baseMixin.methods.dispatchStoreActionWithLogging(
|
||||
storeActions.LOG_EXPERIMENT_EXPOSURE,
|
||||
storeActions.LOG_EXPERIMENT_EXPOSURE_AND_UPDATE_STORE,
|
||||
{
|
||||
userId: getUserIdValue(),
|
||||
deviceId: getDeviceIdValue(),
|
||||
|
|
|
|||
|
|
@ -1262,10 +1262,23 @@ export const actions = {
|
|||
},
|
||||
|
||||
// Analytics Actions
|
||||
logExperimentExposure(
|
||||
logExperimentExposureAndUpdateStore(
|
||||
context,
|
||||
{ payload: { userId, deviceId, sessionKey, pageName, experiment }, pageNameToLog }
|
||||
) {
|
||||
const experiments = deepClone(context.getters.applicationUser.experiments);
|
||||
const experimentToMarkAsExposed = experiments.find(ex => {
|
||||
ex.universeId == experiment.universeId &&
|
||||
ex.testId == experiment.testIde &&
|
||||
ex.variationId == experiment.variationId &&
|
||||
ex.assignmentId == experiment.assignmentId
|
||||
});
|
||||
if (experimentToMarkAsExposed) {
|
||||
experimentToMarkAsExposed.isExposed = true;
|
||||
}
|
||||
|
||||
context.commit(storeMutations.UPDATE_EXPERIMENTS, experiments);
|
||||
|
||||
return globalMethods.callHttpClient({
|
||||
method: endpoints.LogExperimentExposureIfAssigned.method,
|
||||
endpoint: endpoints.LogExperimentExposureIfAssigned.url,
|
||||
|
|
|
|||
Loading…
Reference in a new issue