feat: AA-1121: Add in eventing for Goals (#770)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useState } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
|
||||
import { Header } from '../../course-header';
|
||||
@@ -28,6 +29,10 @@ function GoalUnsubscribe({ intl }) {
|
||||
setError(true);
|
||||
},
|
||||
);
|
||||
// We unfortunately have no information about the user, course, org, or really anything
|
||||
// as visiting this page is allowed to be done anonymously and without the context of the course.
|
||||
// The token can be used to connect a user and course, it will just require some post-processing
|
||||
sendTrackEvent('edx.ui.lms.goal.unsubscribe', { token });
|
||||
}, []); // deps=[] to only run once
|
||||
|
||||
return (
|
||||
|
||||
@@ -2,6 +2,8 @@ import React, { useState } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { Form, Card, Icon } from '@edx/paragon';
|
||||
import { sendTrackEvent } from '@edx/frontend-platform/analytics';
|
||||
import { getAuthenticatedUser } from '@edx/frontend-platform/auth';
|
||||
import { injectIntl, intlShape } from '@edx/frontend-platform/i18n';
|
||||
import { Email } from '@edx/paragon/icons';
|
||||
import { useSelector } from 'react-redux';
|
||||
@@ -22,8 +24,11 @@ function WeeklyLearningGoalCard({
|
||||
|
||||
const {
|
||||
isMasquerading,
|
||||
org,
|
||||
} = useModel('courseHomeMeta', courseId);
|
||||
|
||||
const { administrator } = getAuthenticatedUser();
|
||||
|
||||
const [daysPerWeekGoal, setDaysPerWeekGoal] = useState(daysPerWeek);
|
||||
// eslint-disable-next-line react/prop-types
|
||||
const [isGetReminderSelected, setGetReminderSelected] = useState(subscribedToReminders);
|
||||
@@ -35,6 +40,13 @@ function WeeklyLearningGoalCard({
|
||||
setDaysPerWeekGoal(days);
|
||||
if (!isMasquerading) { // don't save goal updates while masquerading
|
||||
saveWeeklyLearningGoal(courseId, days, selectReminders);
|
||||
sendTrackEvent('edx.ui.lms.goal.days-per-week.changed', {
|
||||
org_key: org,
|
||||
courserun_key: courseId,
|
||||
is_staff: administrator,
|
||||
num_days: days,
|
||||
reminder_selected: selectReminders,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,6 +55,13 @@ function WeeklyLearningGoalCard({
|
||||
setGetReminderSelected(isGetReminderChecked);
|
||||
if (!isMasquerading) { // don't save goal updates while masquerading
|
||||
saveWeeklyLearningGoal(courseId, daysPerWeekGoal, isGetReminderChecked);
|
||||
sendTrackEvent('edx.ui.lms.goal.reminder-selected.changed', {
|
||||
org_key: org,
|
||||
courserun_key: courseId,
|
||||
is_staff: administrator,
|
||||
num_days: daysPerWeekGoal,
|
||||
reminder_selected: isGetReminderChecked,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user