Skip to content

fix: align identity events with mParticle batch schema#88

Merged
khushi1033 merged 2 commits intodevelopmentfrom
fix/identity-event-batch-format
Apr 16, 2026
Merged

fix: align identity events with mParticle batch schema#88
khushi1033 merged 2 commits intodevelopmentfrom
fix/identity-event-batch-format

Conversation

@khushi1033
Copy link
Copy Markdown
Contributor

@khushi1033 khushi1033 commented Apr 16, 2026

Summary##

Refactors identity events to use the mParticle batch event schema format ({ event_type, data })

Event types are mapped per the Rokt Brain Data Model:

  • onLoginCompletelogin
  • onLogoutCompletelogout
  • onModifyCompletemodify_user
  • onUserIdentifiedidentify

MPID and UserIdentities are removed from individual events — they're already on the batch envelope (batch.mpid, batch.user_identities) and don't need to be duplicated per-event. EventDataType and EventCategory are dropped as mParticle SDK internals with no Rokt equivalent.

Before:

{
  "EventName": "login",
  "EventDataType": 14,
  "EventCategory": 0,
  "Timestamp": 1775491325250,
  "MPID": "861148",
  "SessionId": "1EA1DFD3",
  "UserIdentities": { "email": "jenny@rokt.com" }
}

After:

{
  "mpid": "8611485194723014758",
  "user_identities": {
    "customer_id": "2caa7a4d007b44139e0e17b7a23ac7fb",
    "email": "jenny.smith@rokt.com",
    "other_id_6": "CDID1.9.8921.1744745313237"
  },
  // ... rest of batch payload (user_attributes, consent_state, device_info, etc.)
  "events": [
    {
      "event_type": "login",
      "data": {
        "timestamp_unixtime_ms": 1775491325250,
        "session_uuid": "1EA1DFD3-0FBA-42F5-9FA9-6301AA4FC784",
        "mpid": "8611485194723014758"
      }
    }
  ]
}

Testing Plan

  • 170/170 Vitest tests pass (lint and build clean)
  • Updated 5 identity event test assertions to validate new shape (event_type, data.timestamp_unixtime_ms)
  • Tests cover: correct event_type per callback, merge into outgoing batches, queue flush on kit init, and queue cleared after send

@khushi1033 khushi1033 marked this pull request as ready for review April 16, 2026 15:26
@khushi1033 khushi1033 merged commit ddcfa61 into development Apr 16, 2026
5 checks passed
github-actions Bot pushed a commit that referenced this pull request Apr 16, 2026
## [1.24.1](v1.24.0...v1.24.1) (2026-04-16)

### Bug Fixes

* align identity events with mParticle batch schema ([#88](#88)) ([ddcfa61](ddcfa61))
@mparticle-automation
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.24.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

jamesnrokt added a commit that referenced this pull request Apr 16, 2026
Resolves conflict between DRY refactor (handleIdentityComplete) and
the identity event schema fix (#88) by using RoktIdentityEventType
enum constants in the shared helper.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants