track method
Future<RawEvent?>
track(
- TrackEvent event
)
override
Implementation
@override
track(event) async {
final properties = event.properties ?? {};
final revenue = extractRevenue('revenue', properties);
final currency = extractCurrency('currency', properties, 'USD');
if (revenue != null && currency != null) {
final Map<String, dynamic> otherProperties = {};
for (final entry in properties.entries) {
if (entry.key != 'revenue' && entry.key != 'currency') {
otherProperties[entry.key] = entry.value;
}
}
await appsFlyer!.logEvent(event.event, {
...otherProperties,
"af_revenue": revenue,
"af_currency": currency,
});
} else {
await appsFlyer!.logEvent(event.event, properties);
}
return event;
}