Skip to content

Commit

Permalink
Fix analytics events (#142)
Browse files Browse the repository at this point in the history
* Rename sign in & sign up analytics events

* Send video analytics on course overview page

* Fix 'opened' event in local notifications
  • Loading branch information
kvld authored Oct 31, 2017
1 parent 5e79675 commit 9659782
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions Stepic/AnalyticsEvents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct AnalyticsEvents {
}

struct SignIn {
static let onSocialAuth = "clicked_SignIn_on_social_auth_screen"
static let onSocialAuth = "clicked_SignIn_on_launch_screen"
static let onEmailAuth = "clicked_SignIn_on_email_auth_screen"
static let onSignInScreen = "click_sign_in_with_interaction_type"
static let nextButton = "click_sign_in_next_sign_in_screen"
Expand All @@ -30,7 +30,7 @@ struct AnalyticsEvents {
}

struct SignUp {
static let onSocialAuth = "clicked_SignUp_on_social_auth_screen"
static let onSocialAuth = "clicked_SignUp_on_launch_screen"
static let onEmailAuth = "clicked_SignUp_on_email_auth_screen"
static let onSignUpScreen = "click_registration_with_interaction_type"
static let nextButton = "click_registration_send_ime"
Expand Down Expand Up @@ -80,6 +80,10 @@ struct AnalyticsEvents {
static let anonymous = "join_course_anonymous"
static let signed = "join_course_signed"
}
struct Video {
static let clicked = "course_detail_video_clicked"
static let shown = "course_detail_video_shown"
}
}

struct Step {
Expand Down Expand Up @@ -138,7 +142,7 @@ struct AnalyticsEvents {

struct LocalNotification {
static let shown = "streak_local_notification_shown"
static let clicked = "streak_local_notification_clicked"
static let opened = "streak_local_notification_opened"
}
struct ImproveAlert {
static let notificationOffered = "streak_improve_alert_notifications_offered"
Expand Down
2 changes: 1 addition & 1 deletion Stepic/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {

func presentStreaks(userActivity: UserActivity) {

AnalyticsReporter.reportEvent(AnalyticsEvents.Streaks.LocalNotification.shown, parameters: [
AnalyticsReporter.reportEvent(AnalyticsEvents.Streaks.LocalNotification.opened, parameters: [
"current": userActivity.currentStreak,
"longest": userActivity.longestStreak,
"percentage": String(format: "%.02f", Double(userActivity.currentStreak) / Double(userActivity.longestStreak))
Expand Down
3 changes: 3 additions & 0 deletions Stepic/CoursePreviewViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ class CoursePreviewViewController: UIViewController, ShareableController {
tableView.reloadData()
resetHeightConstraints()
if let introVideo = c.introVideo {
// Intro presented, send to analytics
AnalyticsReporter.reportEvent(AnalyticsEvents.CourseOverview.Video.shown)
setIntroMode(fromVideo: true)
setupPlayerWithVideo(introVideo)
} else {
Expand Down Expand Up @@ -334,6 +336,7 @@ class CoursePreviewViewController: UIViewController, ShareableController {
if ConnectionHelper.shared.reachability.isReachableViaWiFi() || ConnectionHelper.shared.reachability.isReachableViaWWAN() {
setControls(playing: true)
self.moviePlayer?.play()
AnalyticsReporter.reportEvent(AnalyticsEvents.CourseOverview.Video.clicked)
}
}

Expand Down

0 comments on commit 9659782

Please sign in to comment.