Skip to content

feat: enrich commerce event action from Rokt.CommerceEventType#97

Merged
jaissica12 merged 3 commits into
developmentfrom
feat/rokt-commerce-event-type-enrichment
May 26, 2026
Merged

feat: enrich commerce event action from Rokt.CommerceEventType#97
jaissica12 merged 3 commits into
developmentfrom
feat/rokt-commerce-event-type-enrichment

Conversation

@jaissica12
Copy link
Copy Markdown
Contributor

@jaissica12 jaissica12 commented May 21, 2026

Summary

This PR adds commerce event type enrichment to the Rokt Kit. When the core SDK populates a Rokt.CommerceEventType custom flag on new commerce event types (e.g., payment_succeeded, view_cart), the Kit reads this flag and overrides product_action.action from "unknown" to the actual event name before sending the batch to __batch_stream__.

This is the Kit-side counterpart to the core SDK PR #1269

Changes

  • Added enrichCommerceEventTypes() private method to RoktKit — iterates batch events, skips non-commerce events, reads custom_flags['Rokt.CommerceEventType'], and overrides product_action.action
  • Called in processBatch() before sendBatchStream() so enrichment happens just before __batch_stream__
  • Safe to release independently — if the core SDK hasn't been updated yet, the custom flag is absent and enrichment is a no-op (action remains "unknown")

Testing Plan

  • Added 5 unit tests in #enrichCommerceEventTypes describe block:
    • Replaces action with custom flag value for commerce events
    • Does not modify action when custom flag is absent
    • Does not modify non-commerce events (even if custom flag is present)
    • Enriches only commerce events in a mixed batch
    • Handles batch with no events
  • Verified end-to-end on local playground:
    • [Forwarder] Batch sent to Kit shows action: "unknown"
    • [Rokt Kit] After enrichment shows action: "payment_succeeded"
    • MPServer batch remains action: "unknown" (unaffected)

@jaissica12 jaissica12 changed the title feat: enrich commerce event action from Rokt.CommerceEventType custom… feat: enrich commerce event action from Rokt.CommerceEventType May 21, 2026
Comment thread src/Rokt-Kit.ts Outdated
@jaissica12 jaissica12 requested a review from rmi22186 May 26, 2026 18:12
Comment thread src/Rokt-Kit.ts Outdated
Comment thread src/Rokt-Kit.ts Outdated
@jaissica12 jaissica12 merged commit 1535005 into development May 26, 2026
5 checks passed
github-actions Bot pushed a commit that referenced this pull request May 27, 2026
# [1.27.0](v1.26.3...v1.27.0) (2026-05-27)

### Bug Fixes

* prevent cached commerce attributes in Rokt placements ([#100](#100)) ([7c59fc5](7c59fc5))

### Features

* enrich commerce event action from Rokt.CommerceEventType ([#97](#97)) ([1535005](1535005))
@mparticle-automation
Copy link
Copy Markdown
Collaborator

🎉 This PR is included in version 1.27.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

4 participants