You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 28, 2022. It is now read-only.
I'm designing our segment.io web integration and in the process I've found that analytics.js behaves differently to Analytics for Android with regards to traits.
window.analytics.track('Button Clicked',{button_name: 'Support'});// Sends{// ..."type": "track","context": {// ...// Analytics for Android includes the traits from our previous identify call here, but analytics.js does not// "traits": {// "first_name": "Barry",// "last_name": "From Eastenders"// }},"properties": {"button_name": "Support"}}
I'm not sure what iOS Analytics does or if the SDKs differ by design but I thinkit's a feature we'd like.
I have implemented it via a middleware, but before I went ahead with this it would be good to get some feed back re: why it's not done by default / whether it's a good or bad practice?
window.analytics.addSourceMiddleware(({ payload, next })=>{consttraits=window.analytics.user().traits();payload.obj.context.traits={
...traits,
...payload.obj.context.traits};next(payload);});