Skip to content

Commit ed1a00f

Browse files
committed
Record dosing strategy and services in analytics
1 parent cd91f1c commit ed1a00f

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

Loop/Managers/AnalyticsServicesManager.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,17 @@ final class AnalyticsServicesManager {
3636
analyticsServices.forEach { $0.recordAnalyticsEvent(name, withProperties: properties, outOfSession: outOfSession) }
3737
}
3838

39-
private func identify(_ property: String, value: String) {
39+
func identify(_ property: String, value: String) {
4040
log.debug("Identify %{public}@: %{public}@", property, value)
4141
analyticsServices.forEach { $0.recordIdentify(property, value: value) }
4242
}
4343

44+
func identify(_ property: String, array: [String]) {
45+
log.debug("Identify %{public}@: %{public}@", property, array)
46+
analyticsServices.forEach { $0.recordIdentify(property, array: array) }
47+
}
48+
49+
4450
// MARK: - UIApplicationDelegate
4551

4652
func application(didFinishLaunchingWithOptions launchOptions: [AnyHashable: Any]?) {

Loop/Managers/LoopAppManager.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,12 +244,17 @@ class LoopAppManager: NSObject {
244244

245245
deviceDataManager.onboardingManager = onboardingManager
246246

247+
// Analytics: user properties
247248
analyticsServicesManager.identifyAppName(Bundle.main.bundleDisplayName)
248249

249250
if let workspaceGitRevision = BuildDetails.default.workspaceGitRevision {
250251
analyticsServicesManager.identifyWorkspaceGitRevision(workspaceGitRevision)
251252
}
252253

254+
analyticsServicesManager.identify("Dosing Strategy", value: settingsManager.loopSettings.automaticDosingStrategy.title)
255+
let serviceNames = deviceDataManager.servicesManager.activeServices.map { $0.serviceIdentifier }
256+
analyticsServicesManager.identify("Services", array: serviceNames)
257+
253258
if FeatureFlags.scenariosEnabled {
254259
testingScenariosManager = LocalTestingScenariosManager(deviceManager: deviceDataManager, supportManager: supportManager)
255260
}

0 commit comments

Comments
 (0)