Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Raise an event once at attribution is fetched at the native layers. #56

Open
markgibaud-vtail opened this issue Oct 31, 2021 · 4 comments
Labels

Comments

@markgibaud-vtail
Copy link

Not rocket science here, I suspect this is only not already done as a matter of time/resources! Hoping this request may help.

At the moment the react-native-mparticle only has a method to synchronously get attributions from the likes of Branch, Adjust , etc. This is obviously tricky as on one hand we don't want to call this too early, as in that case there will be no attribution to fetch and it will ultimately not be logged when/if it does arrive. However if we put this call later on in our onboarding flow, the user may quit the app before the attribution is recorded.

In order to be able to log the attribution as soon as it is available, it would be great to have the onAttributionComplete callbacks at the native layer raise an event on the JS layer, that we can subscribe to, and deliver the necessary payload with attribution data.

@willpassidomo
Copy link
Contributor

Hey @markgibaud-vtail thanks for raising this! The blocker for us currently is migrating the SDK initialization logic (MParticle.start(MParticleOptions) to the JS side. Historically, we have strongly recommended that everyone initialize the SDK in Application.onCreate(), primarily to start Kits as early in the application lifecycle as possible. Based on this, in most of our tertiary SDKs that wrap their Native counterparts, the paradigm we follow is 1) require initialization of the SDKs in the native layer 2) interact with the initialized SDK in the platform layer (ie in React, the JS layer)

Now, since attribution can happen quite quickly after initialization, we require AttributionListener instances to be registered from within MParticleOptions so due to this, there is no Native endpoint (MParticle#setAttributionListener() for example) that we can map to from the React JS layer. That is, unless we chose to wrap MParticleOptions altogether and go down the path of allowing full-on initialization from JS.

Obviously, there are some assumptions we could and are revisiting here; do we need to initialize exactly in onCreate(), are there any downsides of opening an additional API to register an AttributionListener after SDK initialization, etc. Basically, this is my long-winded way of saying "we agree but there are a few complicating factors beyond just adding a mapping" :)

@markgibaud-vtail
Copy link
Author

markgibaud-vtail commented Nov 17, 2021

Hi @willpassidomo thanks for the reply and description! I imagined it wasn't straight forward.

One option is checking out how react-native-voip-notification lib does it, where they just store the events on the native side until the RN side is detected to be up / listener wired up, then send over the collection of events. Requires implementing startObserving and blah blah on the RN side so also not trivial but perhaps an option!

https://github.com/react-native-webrtc/react-native-voip-push-notification/blob/master/ios/RNVoipPushNotification/RNVoipPushNotificationManager.m#L116

react-native-callkeep has a similar approach:

https://github.com/react-native-webrtc/react-native-callkeep/blob/master/ios/RNCallKeep/RNCallKeep.m#L108

Not causing us any huge issues so far though, just a code convenience, so happy for this to go into the backlog until there are more requests around it!

@einsteinx2
Copy link

Tracking internally as ticket #76390.

This is in the backlog, but as it's not high priority I can't give a reasonably accurate ETA at this time. We'll update this ticket when more information is available.

@alexs-mparticle
Copy link
Contributor

alexs-mparticle commented Jun 27, 2022

Tracking internally as https://go.mparticle.com/work/SQDSDKS-2772

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants