Feature/4795 feature tracking matomo

This commit is contained in:
JanNiklas Grabowski
2023-06-21 06:24:46 +00:00
committed by Frank Rotermund
parent 013047191e
commit 27723fa953
7 changed files with 155 additions and 34 deletions
@@ -79,6 +79,7 @@ final class PollEditFormCoordinator: Coordinator, Presentable {
guard let self = self else { return }
self.pollEditFormViewModel.stopLoading()
self.log2Analytics(details: details, room: self.parameters.room)
self.completion?()
} failure: { [weak self] error in
guard let self = self else { return }
@@ -154,4 +155,28 @@ final class PollEditFormCoordinator: Coordinator, Presentable {
return mapping[key] ?? EditFormPollType.disclosed
}
// MARK: Bwi tracking
private func log2Analytics(details: EditFormPollDetails, room: MXRoom) {
BWIAnalyticsHelper.getRoomDeviceCount(room: room) { deviceCount in
var eventName: String
switch details.type {
case .undisclosed:
if details.showParticipants {
eventName = "undisclosed_show_participants"
} else {
eventName = "undisclosed"
}
case .disclosed:
if details.showParticipants {
eventName = "disclosed_show_participants"
} else {
eventName = "disclosed"
}
}
BWIAnalytics.sharedTracker.trackEventWithDimension(category: "Feature", action: "SendPoll", dimension: BWIAnalyticsHelper.dimensionForDeviceCount(deviceCount), value: NSNumber(value: details.answerOptions.count), name: eventName)
}
}
}