Skip to content

Commit

Permalink
add or replace traits properties instead of replacing the complete ob…
Browse files Browse the repository at this point in the history
…ject
  • Loading branch information
prabrisha-rudder committed Nov 21, 2019
1 parent ea2f43e commit a911bf3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rudder-client-javascript/analytics/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,17 @@ class Analytics {
* @memberof Analytics
*/
processIdentify(userId, traits, options, callback) {
if(userId !== this.userId){
this.reset();
}
this.userId = userId;
this.storage.setUserId(this.userId);

let rudderElement = new RudderElementBuilder().setType("identify").build();
if (traits) {
this.userTraits = JSON.parse(JSON.stringify(traits));
for(let key in traits){
this.userTraits[key] = traits[key]
}
this.storage.setUserTraits(this.userTraits);
}

Expand Down

0 comments on commit a911bf3

Please sign in to comment.