diff --git a/Podfile b/Podfile index f908e3884..9e9c5451c 100644 --- a/Podfile +++ b/Podfile @@ -69,6 +69,7 @@ abstract_target 'RiotPods' do # PostHog for analytics pod 'PostHog', '~> 1.4.4' + pod 'AnalyticsEvents', :path => '../matrix-analytics-events/AnalyticsEvents.podspec' # Remove warnings from "bad" pods pod 'OLMKit', :inhibit_warnings => true diff --git a/Podfile.lock b/Podfile.lock index 21da4f99d..f356c62a3 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -14,6 +14,7 @@ PODS: - AFNetworking/Serialization (4.0.1) - AFNetworking/UIKit (4.0.1): - AFNetworking/NSURLSession + - AnalyticsEvents (0.1.0) - BlueCryptor (1.0.32) - BlueECC (1.2.5) - BlueRSA (1.0.200) @@ -114,6 +115,7 @@ PODS: - ZXingObjC/All (3.6.5) DEPENDENCIES: + - AnalyticsEvents (from `../matrix-analytics-events/AnalyticsEvents.podspec`) - DGCollectionViewLeftAlignFlowLayout (~> 1.0.4) - DSWaveformImage (~> 6.1.1) - ffmpeg-kit-ios-audio (~> 4.5) @@ -182,8 +184,13 @@ SPEC REPOS: - zxcvbn-ios - ZXingObjC +EXTERNAL SOURCES: + AnalyticsEvents: + :path: "../matrix-analytics-events/AnalyticsEvents.podspec" + SPEC CHECKSUMS: AFNetworking: 7864c38297c79aaca1500c33288e429c3451fdce + AnalyticsEvents: 5d210d99ddf18f3c81116e5c98f6d9f159598f80 BlueCryptor: b0aee3d9b8f367b49b30de11cda90e1735571c24 BlueECC: 0d18e93347d3ec6d41416de21c1ffa4d4cd3c2cc BlueRSA: dfeef51db96bcc4edec654956c1581adbda4e6a3 @@ -224,6 +231,6 @@ SPEC CHECKSUMS: zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c ZXingObjC: fdbb269f25dd2032da343e06f10224d62f537bdb -PODFILE CHECKSUM: 06d0fee10c99dee2531993f8cb2e54ec04f0752b +PODFILE CHECKSUM: 1a5c7e918ee799655f370ad9fae8cd457b8d1ca1 COCOAPODS: 1.11.2 diff --git a/Riot/Managers/Analytics/Analytics.swift b/Riot/Managers/Analytics/Analytics.swift index 6b0bbb7b4..358ce63e0 100644 --- a/Riot/Managers/Analytics/Analytics.swift +++ b/Riot/Managers/Analytics/Analytics.swift @@ -15,6 +15,7 @@ // import PostHog +import AnalyticsEvents @objcMembers class Analytics: NSObject { @@ -112,18 +113,19 @@ import PostHog postHog?.flush() } - func log(event: String) { - postHog?.capture(event) + private func capture(event: DictionaryConvertible, named eventName: String) { + postHog?.capture(eventName, properties: event.dictionary) } - func trackScreen(_ screenName: String) { -// postHog?.capture("screen:\(screenName)") + func trackScreen(_ screen: AnalyticsScreen) { + let event = AnalyticsEventScreen(durationMs: nil, eventName: .screen, screenName: screen.screenName) + capture(event: event, named: event.eventName.rawValue) } func trackE2EEError(_ reason: DecryptionFailureReason, count: Int) { for _ in 0.. { [super viewWillAppear:animated]; - // Screen tracking - [Analytics.shared trackScreen:@"Security"]; - // Release the potential pushed view controller [self releasePushedViewController]; diff --git a/Riot/Modules/Settings/SettingsViewController.m b/Riot/Modules/Settings/SettingsViewController.m index 304266411..b5d4c3b05 100644 --- a/Riot/Modules/Settings/SettingsViewController.m +++ b/Riot/Modules/Settings/SettingsViewController.m @@ -776,9 +776,6 @@ TableViewSectionsDelegate> - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - - // Screen tracking - [Analytics.shared trackScreen:@"Settings"]; // Refresh display [self refreshSettings]; diff --git a/Riot/Modules/StartChat/StartChatViewController.m b/Riot/Modules/StartChat/StartChatViewController.m index 18ef614dd..f9807d408 100644 --- a/Riot/Modules/StartChat/StartChatViewController.m +++ b/Riot/Modules/StartChat/StartChatViewController.m @@ -73,8 +73,6 @@ { [super finalizeInit]; - self.screenName = @"StartChat"; - _isAddParticipantSearchBarEditing = NO; // Prepare room participants diff --git a/Riot/Modules/UserDevices/UsersDevicesViewController.m b/Riot/Modules/UserDevices/UsersDevicesViewController.m index 5371b3100..308f0afcd 100644 --- a/Riot/Modules/UserDevices/UsersDevicesViewController.m +++ b/Riot/Modules/UserDevices/UsersDevicesViewController.m @@ -120,9 +120,6 @@ { [super viewWillAppear:animated]; - // Screen tracking - [Analytics.shared trackScreen:@"UnknownDevices"]; - [self.tableView reloadData]; }