Skip to content

Conversation

rmi22186
Copy link
Collaborator

Summary

This PR adjusts behavior of how we handle other. Previously, other from selectAttributes was dropped as it was assumed to be the customer passing int a hashed email. However, product decided we should treat other as any other attribute.

This PR also removes email in addition to other as an identity if other is passed in.
Finally, if selectPlacement passes in emailsha256, we remove the email identity.

Testing Plan

Unit tests added.

@rmi22186 rmi22186 changed the base branch from main to development August 13, 2025 20:51
Copy link

@BrandonStalnaker BrandonStalnaker left a comment

Choose a reason for hiding this comment

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

LGTM logic wise

src/Rokt-Kit.js Outdated
var data = mergeObjects({}, _data || {});
if (_data.hasOwnProperty(OTHER_IDENTITY)) {
data[EMAIL_SHA256_IDENTITY] = _data[OTHER_IDENTITY];
delete data[OTHER_IDENTITY];

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

oh wait this doesn't delete other from the attributes just from the identities data okay. 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

correct. I decided to make 2 distinct functions to make it clear. good question though

});

it('should prioritize other passed to selectPlacements over other in userIdentities', async () => {
it('should pass the attribute other in selectPlacements directly to Rokt', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
it('should pass the attribute other in selectPlacements directly to Rokt', async () => {
it('should pass the attribute `other` in selectPlacements directly to Rokt', async () => {

src/Rokt-Kit.js Outdated
return data;
}

function sanitizeIdentities(_data) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think sanitize is too vague and generic.

Suggested change
function sanitizeIdentities(_data) {
function sanitizeEmailIdentities(_data) {

@rmi22186 rmi22186 changed the title Feat/sqdsdks 7556 hashed email for rokt feat: SDKE-123 Support hashedEmailUserIdentityType for "other" identity type Sep 18, 2025
src/Rokt-Kit.js Outdated
var EMAIL_IDENTITY = 'email';

// Dynamic identity type for Rokt's emailsha256 identity value which MP doesn't support - will be set during initialization
var OTHER_IDENTITY;

Choose a reason for hiding this comment

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

I think its a bit confusing to name this OTHER_IDENTITY I feel like EMAIL_SHA256_IDENTITY makes more sense here and something like EMAIL_KEY and EMAIL_SHA256_KEY would make more sense for the other 2 variables

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good call

@rmi22186 rmi22186 force-pushed the feat/SQDSDKS-7556-hashed-email-for-rokt branch from 8504101 to e4ca1ed Compare September 23, 2025 01:08
@rmi22186
Copy link
Collaborator Author

@alexs-mparticle @BrandonStalnaker @Mansi-mParticle good for a final review

Copy link

@Mansi-mParticle Mansi-mParticle left a comment

Choose a reason for hiding this comment

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

LGTM

src/Rokt-Kit.js Outdated
// Set dynamic OTHER_IDENTITY based on server settings
// Convert to lowercase since server sends TitleCase (e.g., 'Other' -> 'other')
if (settings.hashedEmailUserIdentityType) {
MAPPED_EMAIL_SHA256_IDENTITY =
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would make MAPPED_EMAIL_SHA256_IDENTITY a standard variable if you plan on assigning it to a value. This looks like a constant as is, so it shouldn't be assigned a value like this.

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.

4 participants