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
import { fetchCmsContentForPage } from "@/helpers/cms-content-helper";
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 { Form, defineRule } from "vee-validate";
import { required } from "@/helpers/validation-rules";
@ -185,6 +185,7 @@ export default {
storeActions.LOG_EXPERIMENT_EXPOSURE,
{
userId: getUserIdValue(),
deviceId: getDeviceIdValue(),
sessionKey: getSessionKeyValue(),
pageName: to.query.fmgPage,
experiment: experimentForLogging,

View file

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

View file

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