diff --git a/Sources/Amplitude/Plugins/iOS/UIKitUserInteractions.swift b/Sources/Amplitude/Plugins/iOS/UIKitUserInteractions.swift index 99d0177..6e50e0c 100644 --- a/Sources/Amplitude/Plugins/iOS/UIKitUserInteractions.swift +++ b/Sources/Amplitude/Plugins/iOS/UIKitUserInteractions.swift @@ -213,13 +213,16 @@ extension UIView: ActionTrackable { @objc func amp_shouldTrack(_ action: Selector, for target: Any?) -> Bool { false } } -extension UIButton { - override var amp_title: String? { currentTitle } +extension UIControl { override func amp_shouldTrack(_ action: Selector, for target: Any?) -> Bool { actions(forTarget: target, forControlEvent: .touchUpInside)?.contains(action.description) ?? false } } +extension UIButton { + override var amp_title: String? { currentTitle ?? currentImage?.accessibilityIdentifier } +} + extension UISegmentedControl { override var amp_title: String? { titleForSegment(at: selectedSegmentIndex) } override func amp_shouldTrack(_ action: Selector, for target: Any?) -> Bool {