Skip to content

Conversation

@jaissica12
Copy link
Contributor

@jaissica12 jaissica12 commented Jan 16, 2026

Summary

  • Adde mParticle custom event logging (Other type) every time selectPlacements is called
  • WILL CHANGE THE TARGET BRANCH WHEN MAIN AND DEVELOPMENT ARE IN SYNC

Testing Plan

  • Added unit tests

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds mParticle custom event logging to track every selectPlacements call for improved visibility and troubleshooting. Each time selectPlacements is invoked, a custom event of type "Other" (EventType 8) is logged with both the developer-passed attributes and the final merged attributes sent to Rokt.

Changes:

  • Added a new logSelectPlacementsEvent function that logs custom events with both original and final attributes as JSON strings
  • Modified selectPlacements to accept and track devPassedAttributes parameter
  • Added comprehensive unit tests for the new logging functionality

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/Rokt-Kit.js Added constant for event name, modified selectPlacements to capture devPassedAttributes, and implemented logSelectPlacementsEvent function
test/src/tests.js Added mParticle.logEvent mock and comprehensive test suite covering various scenarios for the new logging functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jaissica12 jaissica12 changed the base branch from main to development January 16, 2026 22:02
@jaissica12 jaissica12 changed the base branch from development to main January 16, 2026 22:04
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

// limitations under the License.

var name = 'Rokt';
var moduleId = 181;
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

The event name 'selectplacements' is all lowercase without spaces. Consider using a more conventional format like 'Select Placements' (Title Case), 'selectPlacements' (camelCase), or 'select_placements' (snake_case) for better readability and consistency with typical event naming conventions. If this specific format is intentional (e.g., for compatibility with external systems), consider adding a comment explaining why.

Suggested change
var moduleId = 181;
var moduleId = 181;
// The event name must remain in this exact lowercase format to match Rokt's expected event identifier.

Copilot uses AI. Check for mistakes.
}

function stringifyIfObject(value) {
return isObject(value) ? JSON.stringify(value) : '{}';
Copy link

Copilot AI Jan 23, 2026

Choose a reason for hiding this comment

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

JSON.stringify can throw an error if the object contains circular references or other non-serializable values. Consider wrapping this in a try-catch block to handle such cases gracefully, or document that the caller should ensure attributes are JSON-serializable.

Suggested change
return isObject(value) ? JSON.stringify(value) : '{}';
if (!isObject(value)) {
return '{}';
}
try {
return JSON.stringify(value);
} catch (e) {
return '{}';
}

Copilot uses AI. Check for mistakes.
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