Skip to content

Commit

Permalink
feat: add Segment event for rendering Xpert and bump frontend-lib-lea…
Browse files Browse the repository at this point in the history
…rning-assistant version (#1182)

In order to diagnose low usage rates, we're temporarily adding Segment events for rendering the chat and for closing the call-to-action message. This will help us determine whether Xpert is being successfully rendered and whether Xpert is being ignored by tracking whether learners close the call-to-action message at a high rate.

At a minimum, we expect to remove the Segment event for rendering the Xpert, because this will be a very noisy Segment event. We plan to leave it in for a few days just to accumulate data. We will evaluate whether to keep the call-to-action dismissal Segment event based on the data.

This commit adds the Segment event for rendering the Xpert. This commit also installs version 1.11.1 of frontend-lib-learning-assistant, which introduces a Segment event for for closing the call-to-action message.
  • Loading branch information
MichaelRoytman authored Sep 8, 2023
1 parent 81a49bd commit f58d6d6
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@edx/brand": "npm:@edx/[email protected]",
"@edx/frontend-component-footer": "12.0.0",
"@edx/frontend-component-header": "4.0.0",
"@edx/frontend-lib-learning-assistant": "^1.9.4",
"@edx/frontend-lib-learning-assistant": "^1.11.1",
"@edx/frontend-lib-special-exams": "2.20.1",
"@edx/frontend-platform": "4.3.0",
"@edx/paragon": "20.46.0",
Expand Down
10 changes: 10 additions & 0 deletions src/courseware/course/chat/Chat.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import PropTypes from 'prop-types';
import { Xpert } from '@edx/frontend-lib-learning-assistant';
import { injectIntl } from '@edx/frontend-platform/i18n';

import { sendTrackEvent } from '@edx/frontend-platform/analytics';

const Chat = ({
enabled,
enrollmentMode,
Expand Down Expand Up @@ -40,6 +42,14 @@ const Chat = ({
&& (isEnrolled || isStaff) // display only to enrolled or staff
);

// TODO: Remove this Segment alert. This has been added purely to diagnose whether
// usage issues are as a result of the Xpert toggle button not appearing.
if (shouldDisplayChat) {
sendTrackEvent('edx.ui.lms.learning_assistant.render', {
course_id: courseId,
});
}

return (
<>
{/* Use a portal to ensure that component overlay does not compete with learning MFE styles. */}
Expand Down

0 comments on commit f58d6d6

Please sign in to comment.