CASH-166 | Changes to how experiment endpoints are called

"run" endpoint changed parameter name to deviceId to better reflect what is being passed

"logExposure" sends deviceId as well as userId now because it is used by new functionality
This commit is contained in:
Scott Kiener 2025-01-29 15:24:37 -05:00
parent 4456996c3d
commit 5e47dd7bd2
3 changed files with 8 additions and 6 deletions

View file

@ -80,7 +80,7 @@ import vehicleQuestion from "@/layouts/vehicle/vehicle-question/vehicle-question
// Supporting files // Supporting files
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper"; import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
import { experimentUniverses } from "@/constants/experiments"; import { experimentUniverses } from "@/constants/experiments";
import { getSessionKeyValue, getUserIdValue } from "@/helpers/heritage-integration/cookie-helper"; import { getSessionKeyValue, getUserIdValue, getDeviceIdValue } from "@/helpers/heritage-integration/cookie-helper";
import { settleAllPromises } from "@/helpers/layout-helper"; import { settleAllPromises } from "@/helpers/layout-helper";
import { Form, defineRule } from "vee-validate"; import { Form, defineRule } from "vee-validate";
import { required } from "@/helpers/validation-rules"; import { required } from "@/helpers/validation-rules";
@ -185,6 +185,7 @@ export default {
storeActions.LOG_EXPERIMENT_EXPOSURE, storeActions.LOG_EXPERIMENT_EXPOSURE,
{ {
userId: getUserIdValue(), userId: getUserIdValue(),
deviceId: getDeviceIdValue(),
sessionKey: getSessionKeyValue(), sessionKey: getSessionKeyValue(),
pageName: to.query.fmgPage, pageName: to.query.fmgPage,
experiment: experimentForLogging, experiment: experimentForLogging,

View file

@ -797,7 +797,7 @@ async function runExperiments(nextPage) {
await baseMixin.methods.dispatchStoreActionWithLogging( await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.RUN_EXPERIMENTS_FOR_TRIGGER, storeActions.RUN_EXPERIMENTS_FOR_TRIGGER,
{ {
userId: getDeviceIdValue(), deviceId: getDeviceIdValue(),
triggerEvent: experimentTriggers.SITE_ENTRY, triggerEvent: experimentTriggers.SITE_ENTRY,
triggerValue: applicationConfig.SITE_ENTRY_TRIGGER_VALUE, triggerValue: applicationConfig.SITE_ENTRY_TRIGGER_VALUE,
}, },
@ -808,7 +808,7 @@ async function runExperiments(nextPage) {
await baseMixin.methods.dispatchStoreActionWithLogging( await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.RUN_EXPERIMENTS_FOR_TRIGGER, storeActions.RUN_EXPERIMENTS_FOR_TRIGGER,
{ {
userId: getDeviceIdValue(), deviceId: getDeviceIdValue(),
triggerEvent: experimentTriggers.PAGE_ENTRY, triggerEvent: experimentTriggers.PAGE_ENTRY,
triggerValue: nextPage, triggerValue: nextPage,
}, },

View file

@ -1244,7 +1244,7 @@ export const actions = {
// Analytics Actions // Analytics Actions
logExperimentExposure( logExperimentExposure(
context, context,
{ payload: { userId, sessionKey, pageName, experiment }, pageNameToLog } { payload: { userId, deviceId, sessionKey, pageName, experiment }, pageNameToLog }
) { ) {
return globalMethods.callHttpClient({ return globalMethods.callHttpClient({
method: endpoints.LogExperimentExposureIfAssigned.method, method: endpoints.LogExperimentExposureIfAssigned.method,
@ -1252,6 +1252,7 @@ export const actions = {
payload: { payload: {
experimentForLogging: { experimentForLogging: {
userId: userId, userId: userId,
deviceId: deviceId,
experimentUniverseId: experiment.universeId, experimentUniverseId: experiment.universeId,
experimentUniverseName: experiment.universeName, experimentUniverseName: experiment.universeName,
experimentTestId: experiment.testId, experimentTestId: experiment.testId,
@ -1455,7 +1456,7 @@ export const actions = {
async runExperimentsForTrigger( async runExperimentsForTrigger(
context, context,
{ payload: { userId, triggerEvent, triggerValue }, pageNameToLog } { payload: { deviceId, triggerEvent, triggerValue }, pageNameToLog }
) { ) {
if (triggerEvent == experimentTriggers.SITE_ENTRY) { if (triggerEvent == experimentTriggers.SITE_ENTRY) {
context.commit(storeMutations.UPDATE_TRIGGERED_SITE_ENTRY, true); context.commit(storeMutations.UPDATE_TRIGGERED_SITE_ENTRY, true);
@ -1463,7 +1464,7 @@ export const actions = {
var payload = { var payload = {
applicationName: applicationConfig.APPLICATION_NAME, applicationName: applicationConfig.APPLICATION_NAME,
userId: userId, deviceId: deviceId,
triggerEvent: triggerEvent, triggerEvent: triggerEvent,
triggerValue: triggerValue, triggerValue: triggerValue,
experimentOrder: context.getters.experimentOrder, experimentOrder: context.getters.experimentOrder,