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;
Here is a checklist for troubleshooting missing events issue -
Make sure that you’re calling a Segment API method once the library is successfully installed and initialized.
Make sure your application isn’t shutting down before the local queue events are pushed to Segment. You can manually call flush events to ensure the queue is fully processed before shutdown.
Identifier is not present: Segment’s tracking API requires that each payload has a userId and/or anonymousId. If you send events without either the userId or anonymousId, Segment’s tracking API responds with an no_user_anon_id error. Check the event payload and client instrumentation for more details.
Track event is missing name: All Track events to Segment must have a name in string format.
Event dropped during deduplication: Segment automatically adds a messageId field to all payloads and uses this value to deduplicate events. If you’re manually setting a messageId value, ensure that each event has a unique value.
Incorrect credentials: Double check your credentials for your downstream destination(s).
Destination incompatibility: Make sure that the destination you are troubleshooting can accept server-side API calls. You can see compatibility information on the Destination comparison by category page and in the documentation for your specific destination.
Destination-specific requirements: Check out the destination’s documentation to see if there are other requirements for using the method and destination that you’re trying to get working.
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: