Skip to content

Instantly share code, notes, and snippets.

@jacobsapps
Created August 3, 2025 12:00
Show Gist options
  • Save jacobsapps/31fe9c56a580169fb4ccf16f806f77aa to your computer and use it in GitHub Desktop.
Save jacobsapps/31fe9c56a580169fb4ccf16f806f77aa to your computer and use it in GitHub Desktop.
import Mixpanel
final class MixpanelAnalyticsService: AnalyticsService {
func track(event: String, properties: [String: Any]? = nil) {
var enrichedProperties = performanceService.getAllMetrics()
if let customProperties = properties {
enrichedProperties.merge(customProperties) { (_, new) in new }
}
let mixpanelProperties = enrichedProperties.compactMapValues { $0 as? MixpanelType }
mixpanelInstance.track(event: event, properties: mixpanelProperties)
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment