amplitude / amplitude/Amplitude-Swift

Autocapture ElementInteractions does not log which alert/action sheet button was pressed

Ouverte
#254 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
enhancement
Langage dominant
Swift
Étoiles
82
Forks
45
Merge moyen
8 h 54 min
PR mergées (30 j)
7

Description

## Expected Behavior

Autocapture ElementInteractions identifies which button was pressed through its accessibilityIdentifier. For action sheets and alerts I would expect the button text to be logged to be able to identify what the user action was. This is especially important if the button action does not result in a UI change that would be captured through autocapture (e.g. action button does not navigate to a different screen than the the cancel action button).

## Current Behavior

Action sheet logged with title but without clicked button's text:
```
"event_properties": {
"[Amplitude] Action": "longPress",
"[Amplitude] Gesture Recognizer": "UILongPressGestureRecognizer",
"[Amplitude] Hierarchy": "_UIAlertControllerInterfaceActionGroupView → UIView → _UIAlertControllerPhoneTVMacView → UITransitionView → UIWindow",
"[Amplitude] Screen Name": "What would you like to do?",
"[Amplitude] Target View Class": "_UIAlertControllerInterfaceActionGroupView"
},
```

Same behavior for Alert - logged with title but without clicked button's text:
```
"display_name": "[Amplitude] Element Interacted",
"event_id": 703,
"event_properties": {
"[Amplitude] Action": "longPress",
"[Amplitude] Gesture Recognizer": "UILongPressGestureRecognizer",
"[Amplitude] Hierarchy": "_UIAlertControllerInterfaceActionGroupView → UIView → _UIAlertControllerPhoneTVMacView → UITransitionView → UIWindow",
"[Amplitude] Screen Name": "Delete Sign Out",
"[Amplitude] Target View Class": "_UIAlertControllerInterfaceActionGroupView"
},
"event_time": "2025-01-13 18:33:18.869000",
"event_type": "[Amplitude] Element Interacted",
```

## Possible Solution

## Steps to Reproduce

1. Configure Amplitude with autocapture: .elementInteractions
2. Create an alert and an action sheet with multiple buttons
3. Run app, click action to show alert/action sheet. Click buttons on alert/action sheet.
4. Review Amplitude Live View

## Environment
- SDK Version: 1.11.2
- OS Info: iPhone 15 Pro iOS 18.1 Simulator (Xcode 16.2)

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.