Add position x,y for the component that triggered the analytics event
Closed this issue · 0 comments
hernandazevedozup commented
We need to provide a way to add the position for the component when an analytics record is emmited.
Here is how Beagle React emmits the key position
.
In flutter the beagle-web-core cannot provide the x, and y of the component that triggered the analytics event.
We need to provide a way to do it using dart.
See the code below on beagle_js_engine.dart
void _notifyAnalyticsCreateRecordListener(dynamic analyticsRecordMap) {
if(beagleServiceLocator.isRegistered<AnalyticsProvider>()) {
final analyticsProvider = beagleServiceLocator<AnalyticsProvider>();
final record = AnalyticsRecord().fromMap(analyticsRecordMap);
/*
* TODO find a way to extract x,y of the component that triggered the event. Example:
* final componentId = analyticsRecord[analytics.component['id']];
* final position = findPositionByComponentId(componentId); // position.x, position.y
*/
analyticsProvider.createRecord(record);
}
}