-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add Analytics events #258
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the very accurate job! Just minor nits
auth/src/main/java/org/openedx/auth/presentation/logistration/LogistrationViewModel.kt
Outdated
Show resolved
Hide resolved
auth/src/main/java/org/openedx/auth/presentation/restore/RestorePasswordViewModel.kt
Outdated
Show resolved
Hide resolved
auth/src/main/java/org/openedx/auth/presentation/signin/SignInViewModel.kt
Outdated
Show resolved
Hide resolved
auth/src/main/java/org/openedx/auth/presentation/signin/SignInViewModel.kt
Outdated
Show resolved
Hide resolved
profile/src/main/java/org/openedx/profile/presentation/profile/ProfileViewModel.kt
Outdated
Show resolved
Hide resolved
profile/src/main/java/org/openedx/profile/presentation/profile/ProfileViewModel.kt
Outdated
Show resolved
Hide resolved
profile/src/main/java/org/openedx/profile/presentation/profile/ProfileViewModel.kt
Outdated
Show resolved
Hide resolved
profile/src/main/java/org/openedx/profile/presentation/profile/ProfileViewModel.kt
Outdated
Show resolved
Hide resolved
profile/src/main/java/org/openedx/profile/presentation/profile/ProfileViewModel.kt
Outdated
Show resolved
Hide resolved
751a468
to
5ae94f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some things to look into:
- Discovery Events are implemented for Native experience only.
- CalendarSynnc Action Events is triggering for all cases.
- Please follow a similar convention in Analytics Screen & Keys enum names.
auth/src/main/java/org/openedx/auth/presentation/AuthAnalytics.kt
Outdated
Show resolved
Hide resolved
auth/src/main/java/org/openedx/auth/presentation/logistration/LogistrationViewModel.kt
Outdated
Show resolved
Hide resolved
course/src/main/java/org/openedx/course/presentation/CourseAnalytics.kt
Outdated
Show resolved
Hide resolved
core/src/main/java/org/openedx/core/module/download/BaseDownloadViewModel.kt
Outdated
Show resolved
Hide resolved
course/src/main/java/org/openedx/course/presentation/outline/CourseOutlineViewModel.kt
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The currentVideoTime
is always returning 0 in evens.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can create a bug ticket to tackle currentVideoTime as according to current implementation it is hard to trace why its not working
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay but Please create and attach the bug ticket here. 👍🏻
0dfd4fd
to
4a4135b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Discovery Events are implemented for Native experience only.
- WhatsNew:Close event is not implemented
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay but Please create and attach the bug ticket here. 👍🏻
core/src/main/java/org/openedx/core/module/download/BaseDownloadViewModel.kt
Outdated
Show resolved
Hide resolved
course/src/main/java/org/openedx/course/presentation/container/CourseContainerViewModel.kt
Show resolved
Hide resolved
course/src/main/java/org/openedx/course/presentation/CourseAnalytics.kt
Outdated
Show resolved
Hide resolved
course/src/main/java/org/openedx/course/presentation/dates/CourseDatesViewModel.kt
Show resolved
Hide resolved
course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt
Outdated
Show resolved
Hide resolved
course/src/main/java/org/openedx/course/presentation/container/CourseContainerFragment.kt
Outdated
Show resolved
Hide resolved
core/src/main/java/org/openedx/core/presentation/dialog/alert/ActionDialogFragment.kt
Outdated
Show resolved
Hide resolved
- Add analytics for following modules - AppReview, Profile, WhatsNew, Course, Discussion, Logistration, MainDashboard, Discovery - Restructure the analytics implementation to module level - Update the event names accordingly fix: LEARNER-9876
fix: LEARNER-9876
fix: LEARNER-9876
fix: LEARNER-9876
fix: LEARNER-9876
fix: LEARNER-9876
fix: LEARNER-9876
fix: LEARNER-9876
7b31d64
to
89a1e83
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, Moin, great work !! 🏎️
fun userLoginEvent(method: String) | ||
fun signUpClickedEvent() | ||
fun createAccountClickedEvent(provider: String) | ||
fun registrationSuccessEvent(provider: String) | ||
fun forgotPasswordClickedEvent() | ||
fun resetPasswordClickedEvent(success: Boolean) | ||
fun setUserIdForSession(userId: Long) | ||
} No newline at end of file | ||
fun logEvent(event: String, params: Map<String, Any?>) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of removing these methods?
I see a similar approach in a few other interfaces, but that leads to inconsistency with CourseAnalytics, DashboardAnalytics, DiscoveryAnalytics, DiscussionAnalytics, etc.
We should select one approach and follow it for all modules.
My +1 for keeping methods in interfaces: They help quickly understand what this interface does, same to table of contents in books;
abstract method logEvent
cannot provide this information.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of removing these methods?
- We're moving methods to ViewModels for better organization and maintenance. Each ViewModel handles its own analytics, making future changes easier without affecting other code. This promotes code reuse and reduces the risk of errors.
I see a similar approach in a few other interfaces, but that leads to inconsistency with CourseAnalytics, DashboardAnalytics, DiscoveryAnalytics, DiscussionAnalytics, etc.
- Some methods may still exist from a previous approach, but lack proper event details. These can be addressed in an improvement ticket, ensuring that any remaining methods are properly handled and documented for clarity and future maintenance.
We should select one approach and follow it for all modules. My +1 for keeping methods in interfaces: They help quickly understand what this interface does, same to table of contents in books;
abstract method logEvent cannot provide this information.
- In some cases, we use default logEvent instead custom method which can be improved in a separate ticket for better understanding and readability.
If you have any alternative solutions in mind, we're open to considering them as well.
viewModel.preloadCourseStructure() | ||
advanceUntilIdle() | ||
|
||
coVerify(exactly = 1) { interactor.preloadCourseStructure(any()) } | ||
verify(exactly = 1) { analytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @volodymyr-chekyrta,
As per the current implementation, we are not verifying the method with a specific value.
i.e, coVerify(exactly = 1) { interactor.preloadCourseStructure(any()) }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the case of interactor.preloadCourseStructure(any())
, it's not important what value is passed as an argument, but in the case of analytics.logEvent
, we need to check what event we logged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have create a new PR for these changes Please have a look
viewModel.preloadCourseStructure() | ||
advanceUntilIdle() | ||
|
||
coVerify(exactly = 1) { interactor.preloadCourseStructure(any()) } | ||
verify(exactly = 1) { analytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
advanceUntilIdle() | ||
|
||
coVerify(exactly = 1) { interactor.enrollInACourse(any()) } | ||
verify(exactly = 1) { analytics.courseEnrollClickedEvent(any(), any()) } | ||
verify(exactly = 0) { analytics.courseEnrollSuccessEvent(any(), any()) } | ||
verify(exactly = 1) { analytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
viewModel.preloadCourseStructure() | ||
advanceUntilIdle() | ||
|
||
coVerify(exactly = 1) { interactor.preloadCourseStructure(any()) } | ||
verify(exactly = 1) { analytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
downloadDao, | ||
workerController | ||
) | ||
|
||
viewModel.saveDownloadModels("", "") | ||
advanceUntilIdle() | ||
verify(exactly = 1) { coreAnalytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
@@ -70,6 +76,7 @@ class VideoUnitViewModelTest { | |||
any() | |||
) | |||
} | |||
verify(exactly = 1) { courseAnalytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
@@ -96,6 +105,7 @@ class VideoUnitViewModelTest { | |||
any() | |||
) | |||
} | |||
verify(exactly = 1) { courseAnalytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
@@ -67,18 +72,21 @@ class VideoViewModelTest { | |||
any() | |||
) | |||
} | |||
verify(exactly = 1) { courseAnalytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
@@ -87,6 +95,7 @@ class VideoViewModelTest { | |||
any() | |||
) | |||
} | |||
verify(exactly = 1) { courseAnalytics.logEvent(any(), any()) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should check specific value, not any
Description
fix: LEARNER-9876