segmentio / analytics-next

Segment Analytics.js 2.0
https://segment.com/docs/connections/sources/catalog/libraries/website/javascript
MIT License
413 stars 138 forks source link

`track` deletes traits in @segment/analytics-next #1173

Open jonathanj opened 4 weeks ago

jonathanj commented 4 weeks ago

This code deletes the traits property for "track" events, but I'm not sure I understand why. I can't seem to find any documentation that explains why this would be desirable.

I'm implementing a custom plugin that injects traits into events other than identify because our analytics team is having some difficulty when these events end up at the Mixpanel destination and this information is missing. We have implemented the same behaviour for the React Native client, which doesn't seem to suffer from the issue of traits being purged for track events.

Is there a reason why traits would be deleted from track but not from screen/page? Is my intended usage an anti-pattern?