From 4983fd6b65bcee7bb09b2d54e0bb499807d0c251 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 6dbc69a..0c74f10 100644 --- a/LoopSupportKitUI/LoopKitAnalytics.swift +++ b/LoopSupportKitUI/LoopKitAnalytics.swift @@ -61,10 +61,26 @@ public class LoopKitAnalytics { amplitude.initializeApiKey("7dd7414785560c0dd1ef802ac10c00b4") amplitude.setServerUrl("https://ingest.loopkit.org/v1/events") 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 cedd5cb408077c20b4b38fcafaa4cf9a61e4a68c 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 0c74f10..6828407 100644 --- a/LoopSupportKitUI/LoopKitAnalytics.swift +++ b/LoopSupportKitUI/LoopKitAnalytics.swift @@ -78,6 +78,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 }