Skip to content

Conversation

@guillermot
Copy link
Collaborator

Summary

This PR adds performance monitoring capabilities to the Rokt JavaScript integration kit by implementing a performance mark that tracks when the Rokt launcher script is successfully appended to the DOM. This enhancement enables better observability and performance tracking for Rokt integration initialization.

Changes Made:

  • Added PerformanceMarks object - Introduced a centralized object to define performance metric names
  • Implemented captureTimings function - Created a utility function that safely calls window.mParticle.captureTiming() when available
  • Added performance mark on script append - When the Rokt launcher script is appended to the DOM, the kit now captures a performance timing mark named 'RoktScriptAppended'
  • Updated test configuration - Modified karma config to use only ChromeHeadless for consistency

Testing Plan

  • Performance Mark Capture Test - Verifies that 'RoktScriptAppended' performance mark is captured when script is appended
  • Mock Setup - Tests properly mock window.mParticle.captureTiming to capture the metric name

@guillermot guillermot changed the title Add Performance Mark for Rokt Script Appended (SDKE-405) feat: Add Performance Mark for Rokt Script Appended (SDKE-405) Oct 20, 2025
@guillermot guillermot changed the base branch from main to development October 20, 2025 18:20
@guillermot guillermot marked this pull request as ready for review October 21, 2025 16:04
src/Rokt-Kit.js Outdated

target.appendChild(script);
captureTimings(PerformanceMarks.RoktScriptAppended);
captureTiming(mParticle.PerformanceMarkType.RoktScriptAppended);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is annoying, but in a world where a customer is hosting this on NPM, we'd need to check to ensure mParticle.PerformanceMarkType exists. This is an argument to just keep PerformanceMarks in this file to ensure it's always available.
cc @mattbodle

Copy link
Collaborator Author

@guillermot guillermot Oct 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, makes sense, forgot about npm package. let me rollback changes

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@rmi22186
Copy link
Collaborator

approved, but needs to wait until https://github.com/mParticle/mparticle-web-sdk/pull/1101/files is fully rolled out to all customers

@guillermot guillermot merged commit a181f54 into development Oct 27, 2025
4 checks passed
github-actions bot pushed a commit that referenced this pull request Oct 27, 2025
# [1.12.0](v1.11.0...v1.12.0) (2025-10-27)

### Features

* Add Performance Mark for Rokt Script Appended (SDKE-405) ([#50](#50)) ([a181f54](a181f54))
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.

3 participants