recordInteraction method
Record an interaction.
Implementation
Future<void> recordInteraction(
String userId,
String widgetId,
String action,
) async {
final docRef = _firestore.collection('user_states').doc(userId);
await docRef.set({
'actions': FieldValue.arrayUnion([
{
'widget_id': widgetId,
'action': action,
'timestamp': FieldValue.serverTimestamp(),
}
]),
}, SetOptions(merge: true));
}