track method
Implementation
@override
Future<void> track(String event, {Map<String, dynamic>? properties}) async {
if (event.trim().isEmpty) {
return;
}
await _requestJson(
_apiUrl('/app-events'),
method: 'POST',
headers: _buildHeaders(includeContentType: true),
body: <String, dynamic>{
'type': event,
'platform': 'web',
'timestamp': DateTime.now().millisecondsSinceEpoch ~/ 1000,
if (_lastPayload?.cid != null) 'cid': _lastPayload!.cid,
if (_lastPayload?.linkId != null) 'linkId': _lastPayload!.linkId,
if (_userId != null && _userId!.isNotEmpty) 'userId': _userId,
if (properties != null) 'detail': jsonEncode(properties),
},
);
}