Skip to content

Commit

Permalink
fix: modify optimizely tracking calls (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
alangsto authored Jul 22, 2024
1 parent 7bf56c6 commit 0ff4d4f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/data/thunks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';

import { trackChatBotMessageOptimizely } from '../utils/optimizelyExperiment';
import trackChatBotMessageOptimizely from '../utils/optimizelyExperiment';
import fetchChatResponse, { fetchLearningAssistantEnabled } from './api';
import {
setCurrentMessage,
Expand Down Expand Up @@ -60,7 +60,7 @@ export function getChatResponse(courseId, unitId, promptExperimentVariationKey =
dispatch(setApiIsLoading(true));
try {
if (promptExperimentVariationKey) {
trackChatBotMessageOptimizely(userId);
trackChatBotMessageOptimizely(userId.toString());
}
const customQueryParams = promptExperimentVariationKey ? { responseVariation: promptExperimentVariationKey } : {};
const message = await fetchChatResponse(courseId, messageList, unitId, customQueryParams);
Expand Down
10 changes: 1 addition & 9 deletions src/utils/optimizelyExperiment.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
import { getOptimizely } from '../data/optimizely';

const trackChatBotLaunchOptimizely = (userId, userAttributes = {}) => {
const optimizelyInstance = getOptimizely();
optimizelyInstance.track('learning_assistant_chat_click', userId, userAttributes);
};

const trackChatBotMessageOptimizely = (userId, userAttributes = {}) => {
const optimizelyInstance = getOptimizely();
optimizelyInstance.track('learning_assistant_chat_message', userId, userAttributes);
};

export {
trackChatBotLaunchOptimizely,
trackChatBotMessageOptimizely,
};
export default trackChatBotMessageOptimizely;

0 comments on commit 0ff4d4f

Please sign in to comment.