segmentio/analytics.js-integrations

Feature request: Support for passing traits to analytics.track()

bradvogel opened this issue · 0 comments

My current understanding of Segment's API:

  1. analytics.track() supports passing properties associated with the event.
  2. analytics.identify() supports passing traits that are associated with the user.
  3. #1 and #2 above are two separate API calls and there is no ordering guarantee; that is, they'll won't be delivered to the destination in the same order they were called.

This is a problem because some destinations, such as Amplitude, will associate traits with events under-the-hood. So if the event was sent to the destination, Amplitude, before the traits, the traits won't be associated with that event and thus will be useless.

For this reason, Amplitude supports passing user traits along with API calls to create events here,. This essentially combines analytics.track() and analytics.identify() into a single, atomic API call to:

  1. Create a new event
  2. Associate properties with that event
  3. Update traits on the user that are queryable in Amplitude at the time of that event

Would it be possible to add the ability to pass traits to analytics.track() that will be forwarded to destinations that support it?