nytimes / react-tracking

🎯 Declarative tracking for React apps.
https://open.nytimes.com/introducing-react-tracking-declarative-tracking-for-react-apps-2c76706bb79a
Other
1.88k stars 123 forks source link

Expose return value of dispatch call via trackEvent #91

Open jmif opened 6 years ago

jmif commented 6 years ago

This allows us to receive the result of the dispatch function in trackEvent calls.

Main use case for this is waiting to execute code until the event has been successfully tracked. Our tracking method inside of dispatch() returns a promise that resolves when the event has been successfully tracked.

We can use this to delay execution of events (for example exiting link clicks on critical events) until the event has tracked.

tizmagik commented 6 years ago

Nice. The use case makes sense 👍

Mind adding some docs and a test case please?

jbadeau commented 6 years ago

Yes, some documentation would be great