Merge pull request #2280 from Safelite/feature/CASH-183
CASH-183 | Update the store when exposure is logged
This commit is contained in:
commit
af66b4dacc
3 changed files with 16 additions and 3 deletions
|
|
@ -55,7 +55,7 @@ const storeActions = {
|
||||||
GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems",
|
GET_RECAL_PARTS_AND_SAVE_TO_LINE_ITEMS: "getRecalPartsAndSaveToLineItems",
|
||||||
|
|
||||||
// Analytics
|
// Analytics
|
||||||
LOG_EXPERIMENT_EXPOSURE: "logExperimentExposure",
|
LOG_EXPERIMENT_EXPOSURE_AND_UPDATE_STORE: "logExperimentExposureAndUpdateStore",
|
||||||
LOG_PAGE_VIEW: "logPageView",
|
LOG_PAGE_VIEW: "logPageView",
|
||||||
LOG_CUSTOM_EVENT: "logCustomEvent",
|
LOG_CUSTOM_EVENT: "logCustomEvent",
|
||||||
INITIALIZE_SESSION: "initializeSession",
|
INITIALIZE_SESSION: "initializeSession",
|
||||||
|
|
|
||||||
|
|
@ -187,7 +187,7 @@ export default {
|
||||||
if (experimentForLogging !== undefined) {
|
if (experimentForLogging !== undefined) {
|
||||||
// Log experiment exposure
|
// Log experiment exposure
|
||||||
baseMixin.methods.dispatchStoreActionWithLogging(
|
baseMixin.methods.dispatchStoreActionWithLogging(
|
||||||
storeActions.LOG_EXPERIMENT_EXPOSURE,
|
storeActions.LOG_EXPERIMENT_EXPOSURE_AND_UPDATE_STORE,
|
||||||
{
|
{
|
||||||
userId: getUserIdValue(),
|
userId: getUserIdValue(),
|
||||||
deviceId: getDeviceIdValue(),
|
deviceId: getDeviceIdValue(),
|
||||||
|
|
|
||||||
|
|
@ -1287,10 +1287,23 @@ export const actions = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Analytics Actions
|
// Analytics Actions
|
||||||
logExperimentExposure(
|
logExperimentExposureAndUpdateStore(
|
||||||
context,
|
context,
|
||||||
{ payload: { userId, deviceId, sessionKey, pageName, experiment }, pageNameToLog }
|
{ 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({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.LogExperimentExposureIfAssigned.method,
|
method: endpoints.LogExperimentExposureIfAssigned.method,
|
||||||
endpoint: endpoints.LogExperimentExposureIfAssigned.url,
|
endpoint: endpoints.LogExperimentExposureIfAssigned.url,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue