feat: send set_user_attributes event#82
Conversation
|
|
||
| receivedEvents.length.should.equal(1); | ||
| receivedEvents[0].EventName.should.equal('set_user_attributes'); | ||
| receivedEvents[0].EventDataType.should.equal(14); |
There was a problem hiding this comment.
Should this actually be 14? (Did someone decide that and I'm just unaware)
https://github.com/mParticle/mparticle-web-sdk/blob/master/src/types.ts#L16-L20
when there's a user attribute change, MP server expects 17
when there's a user identity change, MP server expects 18. I actually don't know when "Profile" or 14 is used.
There was a problem hiding this comment.
Yeah I discussed with Alex when we were implementing login, logout, identify, and modify_user events, and we decided to go with Profile (14). I assumed we'd want to keep it consistent for this event as well, but if theres a specific type for UserAttributeChange (17) then that probably fits better.
There was a problem hiding this comment.
Technically, this isn't a user attribute change, but a pseudo "new" event, so Profile better aligns with the expected behavior, like we did with the Identity methods.
rmi22186
left a comment
There was a problem hiding this comment.
This LGTM so long as the question about profile has been addressed previously in a conversation I may not be privy to.
# [1.21.0](v1.20.0...v1.21.0) (2026-04-03) ### Features * send set_user_attributes event ([#82](#82)) ([9995f09](9995f09))
|
🎉 This PR is included in version 1.21.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Summary
Extends the kit to emit a
set_user_attributesevent through the Rokt event stream whenever mParticle callssetUserAttributeon the forwarder. This follows the same pattern already established foronLoginComplete,onLogoutComplete,onModifyComplete, andonUserIdentified, which all send identity-category events viawindow.Rokt.__event_stream__.The event reuses the existing
_buildIdentityEventhelper, producing a consistent shape across all identity events:EventName:"set_user_attributes"EventDataType:14(MessageType.Profile)MPID: sourced fromself.filters.filteredUser(stored on the instance)SessionId: sourced fromwindow.mParticle.sessionManagerUserIdentities: sourced fromfilteredUser.getUserIdentities()UserAttributes: the full updated attribute map, merged in by_enrichEventbefore the event is sent
Testing Plan
Unit tests: added covering correct event name and data type, successful stream forwarding with correct payload, queuing when
__event_stream__is unavailable, and no-throw whenwindow.Roktis undefined. Edge case for nullMPIDandUserIdentitieswhenfilteredUseris not set is also covered.Manual: call set user attibutes in the mock app and confirm a
set_user_attributesevent appears in the Rokt event stream with the correct payload in the network tab.