From 6e1ed640a2bcd83c147c24422916d2d3f21d786f Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Tue, 13 Oct 2026 19:35:40 -0500 Subject: [PATCH 1/2] Include build details on the instantiation event Adds the build number and the LoopWorkspace and Loop git branch and revision from BuildDetails.plist, so builds sharing a version string can be told apart. This event is sent at the version-only sharing level. --- LoopSupportKitUI/LoopKitAnalytics.swift | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/LoopSupportKitUI/LoopKitAnalytics.swift b/LoopSupportKitUI/LoopKitAnalytics.swift index cda121c..ee96046 100644 --- a/LoopSupportKitUI/LoopKitAnalytics.swift +++ b/LoopSupportKitUI/LoopKitAnalytics.swift @@ -67,10 +67,26 @@ public class LoopKitAnalytics { amplitude.setTrackingOptions(AMPTrackingOptions().disableCity().disableCarrier().disableIDFA().disableLatLng().disableIPAddress().disableRegion()) amplitude.initializeApiKey("7dd7414785560c0dd1ef802ac10c00b4") client = amplitude - client?.logEvent("LoopKitAnalytics instantiation") + client?.logEvent("LoopKitAnalytics instantiation", withEventProperties: buildProperties) #endif } + private var buildProperties: [String: Any] { + var properties: [String: Any] = [:] + properties["buildNumber"] = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") + guard let url = Bundle.main.url(forResource: "BuildDetails", withExtension: "plist"), + let data = try? Data(contentsOf: url), + let details = try? PropertyListSerialization.propertyList(from: data, format: nil) as? [String: Any] + else { + return properties + } + properties["workspaceBranch"] = details["com-loopkit-LoopWorkspace-git-branch"] + properties["workspaceRevision"] = details["com-loopkit-LoopWorkspace-git-revision"] + properties["loopBranch"] = details["com-loopkit-Loop-git-branch"] + properties["loopRevision"] = details["com-loopkit-Loop-git-revision"] + return properties + } + public func recordAnalyticsEvent(_ name: String, withProperties properties: [AnyHashable : Any]?, outOfSession: Bool) { if usageDataPrivacyPreference == .shareUsageDetailsWithDevelopers { client?.logEvent(name, withEventProperties: properties, outOfSession: outOfSession) From 0318045a806e1a88514486cce96495fa02910aae Mon Sep 17 00:00:00 2001 From: Pete Schwamb Date: Tue, 13 Oct 2026 20:10:46 -0500 Subject: [PATCH 2/2] Include build customizations on the instantiation event Sends the identifiers Loop's build-details script collected from .loopcustomization marker files. --- LoopSupportKitUI/LoopKitAnalytics.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/LoopSupportKitUI/LoopKitAnalytics.swift b/LoopSupportKitUI/LoopKitAnalytics.swift index ee96046..7620b86 100644 --- a/LoopSupportKitUI/LoopKitAnalytics.swift +++ b/LoopSupportKitUI/LoopKitAnalytics.swift @@ -84,6 +84,7 @@ public class LoopKitAnalytics { properties["workspaceRevision"] = details["com-loopkit-LoopWorkspace-git-revision"] properties["loopBranch"] = details["com-loopkit-Loop-git-branch"] properties["loopRevision"] = details["com-loopkit-Loop-git-revision"] + properties["customizations"] = details["com-loopkit-Loop-customizations"] return properties }