You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class SegmentAnalytics implements AnalyticsService {
final _log = 'SegmentAnalytics';
late Analytics _analytics;
late bool enabled;
late String firebaseAppInstanceId;
Map<String, dynamic>? integrations;
I am facing two issues
1: I am not able to add appsFlyerId to integration map on segment event
I have workarround for this find the code below
`import 'dart:async';
import 'package:analytics_service/analytics.dart';
import 'package:mp_logger/mp_logger.dart';
import 'package:segment_analytics/analytics.dart';
import 'package:segment_analytics/client.dart';
import 'package:segment_analytics/event.dart';
import 'package:segment_analytics/plugin.dart';
import 'package:segment_analytics/state.dart';
class SegmentAnalytics implements AnalyticsService {
final _log = 'SegmentAnalytics';
late Analytics _analytics;
late bool enabled;
late String firebaseAppInstanceId;
Map<String, dynamic>? integrations;
@OverRide
Future initialize({
required String writeKey,
required String appInstanceId,
required bool isEnabled,
}) async {
Logger.info(
_log,
'Initializing Segment Analytics with Write Key: $writeKey',
);
enabled = isEnabled;
firebaseAppInstanceId = appInstanceId;
}
@OverRide
Future identify({
required String userId,
UserTraits? userTraits,
bool shouldReset = true,
}) async {
if (!enabled) {
Logger.info(_log, 'identify() skipped, Segment Analytics is disabled.');
return Future.value();
}
}
@OverRide
Future logEvent({
required String event,
Map<String, dynamic>? parameters,
}) {
Logger.info(_log, 'Logging event => $event');
}
@OverRide
Future screen({
required String name,
Map<String, dynamic>? parameters,
}) {
Logger.info(_log, 'Tracking screen => $name');
}
@OverRide
Future alias({required String alias}) {
Logger.info(_log, 'Creating alias for user => $alias');
}
@OverRide
Future flush() {
Logger.info(_log, 'Flushing events');
}
@OverRide
Future group({
required String groupId,
GroupTraits? groupTraits,
}) {
Logger.info(_log, 'Grouping user into group => $groupId');
}
@OverRide
Future reset() async {
Logger.info(_log, 'Resetting analytics data');
}
@OverRide
void setUpIntegrationsMap(String appsFlyerId) {
Logger.info(
_log, 'Setting up integrations map with AppsFlyer ID: $appsFlyerId');
}
}
class AppsFlyerPlugin extends DestinationPlugin {
final String appsFlyerId;
final Map<String, dynamic> integrations;
AppsFlyerPlugin(
super.key, {
required this.appsFlyerId,
required this.integrations,
});
@OverRide
Future<RawEvent?> execute(RawEvent event) async {
// Your custom logic for AppsFlyer
event.integrations = integrations;
return super.execute(event);
}
}`
it adds the intgeration into the events. is this the right approach??
2: many times we have experienced an issue of missed events some events get missed on segment we are unable to find anything
could you please help.
I have attached whole code
The text was updated successfully, but these errors were encountered: