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

[appboy] Pull Request #25: If a message download is in-progress, wait until complete before logging a custom event #114

Open
SegmentDestinationsBot opened this issue Mar 1, 2019 · 0 comments

Comments

@SegmentDestinationsBot
Copy link
Contributor

Migrated from #25 by @hmedney

Basically this keeps track of the callback in a window.appboy scoped var and provides a new function called _messagingReady(callback). Calls to logCustomEvent() can be wrapped as follows:

this._messagingReady(function() {
  window.appboy.logCustomEvent(eventName, properties);
})

When the messages have been downloaded, the callback is invoked. In testing simple pages, it seems to solve the race condition and make the integration more predictable.

For example, if a page instruments as follows:

analytics.load("{writeKey}");
analytics.identify("{userId}")
analytics.page();

The above change will ensure all the Braze in-app messages have been downloaded before the page custom event is called on the SDK.

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

No branches or pull requests

1 participant