Skip to content

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

Open
jaissica12 wants to merge 1 commit into
developmentfrom
feat/rokt-commerce-event-type-enrichment
Open

feat: enrich commerce event action from Rokt.CommerceEventType#97
jaissica12 wants to merge 1 commit 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant