Closed GeorgePagMezzi closed 1 month ago
Hi @GeorgePagMezzi thank you for your report, we start looking into this.
Hi @GeorgePagMezzi sorry to answer late, this is an example to use the AppsFlyerDestination plugin:
Thank you @edsonjab , so appsflyer plugin does not sync from Segment cloud some time after adding it as a plugin to the Analytics
client, based on the settings we have set up on Segment destination dashboard? I looked into it a bit more these days and it appears that after doing
clientAnalytics.addPlugin(appsFlyerDestination);
Function? removeListener;
removeListener = clientAnalytics.state.integrations.addListener((integrationMap) {
if (integrationMap['AppsFlyer'] != null) {
appsFlyerDestination.identify(
IdentifyEvent(
userId: FirebaseAuth.instance.currentUser?.uid,
),
);
if (removeListener != null) {
removeListener();
}
}
});
This integrationMap['AppsFlyer']
object is filled by some values which appear in sync with what is on Segment dashboard, but the above code can still sometimes fail when identify is called due to the exception
Unhandled Exception: Null check operator used on a null value
0 AppsFlyerDestination.identify (package:segment_analytics_plugin_appsflyer/plugin_appsflyer.dart:61:16)
if I
await Future.delayed(seconds: 5) //e.g. and run identify again
appsFlyerDestination.identify(
IdentifyEvent(
userId: FirebaseAuth.instance.currentUser?.uid,
),
);
Then the error goes away, which makes me thing Segment makes some api calls when we add appsflyer as a pluging, but we have no way to await the initialization of appsflyer. I will try your response, but it would be great if we had a way to await the initialization of the destination.
Also it would be great if that Map<String,dynamic> settings object in your screenshot was an object, to avoid misstyping the keys.
@edsonjab When implementing solution from screenshot I get below error:
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value
0 AppsFlyerDestination.update (package:segment_analytics_plugin_appsflyer/plugin_appsflyer.dart:27:35)
plugin_appsflyer.dart:27
and the app hangs upon startup when update
is called.
This happened once the state inside the configuration is not initialized properly, for that reason is important add plugin AppsFlyerDestination after Analytics was created with all configurations:
In that line is failing your code.
I will be closing this issue, as we switched package since package still seems a bit behind the deprecated one. Thank you for trying to solve this! A better documentation or code examples would be great for these kind of issues. Thanks again!
Hello, I just switched over from deprecated Segment package to this one and would like to also include Appsflyer support in order to track attribution data through Segment in my ios app. In my Segment dashboard I have added the 'Appsflyer' destination and included the Apple APP ID, Appsflyer Dev Key andhave enabled 'Track Attribution Data' option. Code on the FE looks like this:
Sadly the attribution does not work on Segment side with this setup (even though deprecated package was somewhat consistent with attribution). Is there anything more I should do? E.G. create an appsflyerDestination object and manually input the settings?
When should I run the
identify
method ofAppsFlyerDestination
class? I also notice that in your docs it says: 'When yousend
this flag theplugin_appsflyer
SDK ignores attribution. What does it mean when you say 'send' (do you mean 'set')? is theplugin_appsflyer
sdk the same assegment_analytics_plugin_appsflyer
?Also if I Restart the app, I get below error. I have declared the
clientAnalytics
variable globally.Thank you in advance and remain at your disposal to provide further info.