recordInteraction method

Future<void> recordInteraction(
  1. String userId,
  2. String widgetId,
  3. String action
)

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));
}