66NSString * const MPKitRoktErrorDomain = @" com.mparticle.kits.rokt" ;
77NSString * const MPKitRoktErrorMessageKey = @" mParticle-Rokt Error" ;
88NSString * const kMPPlacementAttributesMapping = @" placementAttributesMapping" ;
9+ NSString * const kMPHashedEmailUserIdentityType = @" hashedEmailUserIdentityType" ;
10+ NSInteger const kMPRoktKitCode = 181 ;
11+
912static __weak MPKitRokt *roktKit = nil ;
1013
1114@interface MPKitRokt () <MPKitProtocol>
@@ -20,7 +23,7 @@ @implementation MPKitRokt
2023 mParticle will supply a unique kit code for you. Please contact our team
2124*/
2225+ (NSNumber *)kitCode {
23- return @181 ; // Replace with the actual kit code assigned by mParticle
26+ return @( kMPRoktKitCode ) ; // Replace with the actual kit code assigned by mParticle
2427}
2528
2629+ (void )load {
@@ -251,7 +254,7 @@ - (RoktFrameworkType)mapMPWrapperSdkToRoktFrameworkType:(MPWrapperSdk)wrapperSdk
251254 NSArray <NSDictionary *> *kitConfigs = [MParticle sharedInstance ].kitContainer_PRIVATE .originalConfig .copy ;
252255 NSDictionary *roktKitConfig;
253256 for (NSDictionary *kitConfig in kitConfigs) {
254- if (kitConfig[@" id" ] != nil && [kitConfig[@" id" ] integerValue ] == 181 ) {
257+ if (kitConfig[@" id" ] != nil && [kitConfig[@" id" ] integerValue ] == kMPRoktKitCode ) {
255258 roktKitConfig = kitConfig;
256259 }
257260 }
@@ -361,86 +364,86 @@ + (RoktConfig *)convertMPRoktConfig:(MPRoktConfig *)mpRoktConfig {
361364}
362365
363366+ (NSString *)stringForIdentityType : (MPIdentity)identityType {
364- switch (identityType) {
365- case MPIdentityCustomerId:
366- return @" customerid" ;
367-
368- case MPIdentityEmail:
369- return @" email" ;
370-
371- case MPIdentityFacebook:
372- return @" facebook" ;
373-
374- case MPIdentityFacebookCustomAudienceId:
375- return @" facebookcustomaudienceid" ;
376-
377- case MPIdentityGoogle:
378- return @" google" ;
379-
380- case MPIdentityMicrosoft:
381- return @" microsoft" ;
382-
383- case MPIdentityOther:
384- // As of 7/30/2025, "MPIdentityOther" is used by Rokt customers to identify based off hashed email
385- return @" emailsha256" ;
386-
387- case MPIdentityTwitter:
388- return @" twitter" ;
389-
390- case MPIdentityYahoo:
391- return @" yahoo" ;
392-
393- case MPIdentityOther2:
394- return @" other2" ;
395-
396- case MPIdentityOther3:
397- return @" other3" ;
398-
399- case MPIdentityOther4:
400- return @" other4" ;
401-
402- case MPIdentityOther5:
403- return @" other5" ;
404-
405- case MPIdentityOther6:
406- return @" other6" ;
407-
408- case MPIdentityOther7:
409- return @" other7" ;
410-
411- case MPIdentityOther8:
412- return @" other8" ;
413-
414- case MPIdentityOther9:
415- return @" other9" ;
416-
417- case MPIdentityOther10:
418- return @" other10" ;
419-
420- case MPIdentityMobileNumber:
421- return @" mobile_number" ;
422-
423- case MPIdentityPhoneNumber2:
424- return @" phone_number_2" ;
425-
426- case MPIdentityPhoneNumber3:
427- return @" phone_number_3" ;
428-
429- case MPIdentityIOSAdvertiserId:
430- return @" ios_idfa" ;
431-
432- case MPIdentityIOSVendorId:
433- return @" ios_idfv" ;
434-
435- case MPIdentityPushToken:
436- return @" push_token" ;
437-
438- case MPIdentityDeviceApplicationStamp:
439- return @" device_application_stamp" ;
440-
441- default :
442- return nil ;
367+ NSNumber *hashedEmailIdentity = [MPKitRokt getRoktHashedEmailUserIdentityType ];
368+
369+ if (hashedEmailIdentity.unsignedIntValue == identityType) {
370+ return @" emailsha256" ;
371+ }
372+
373+ NSDictionary <NSNumber *, NSString *> *identityStrings = @{@(MPIdentityCustomerId): @" customerid" ,
374+ @(MPIdentityEmail): @" email" ,
375+ @(MPIdentityFacebook): @" facebook" ,
376+ @(MPIdentityFacebookCustomAudienceId): @" facebookcustomaudienceid" ,
377+ @(MPIdentityGoogle): @" google" ,
378+ @(MPIdentityMicrosoft): @" microsoft" ,
379+ @(MPIdentityOther): @" other" ,
380+ @(MPIdentityTwitter): @" twitter" ,
381+ @(MPIdentityYahoo): @" yahoo" ,
382+ @(MPIdentityOther2): @" other2" ,
383+ @(MPIdentityOther3): @" other3" ,
384+ @(MPIdentityOther4): @" other4" ,
385+ @(MPIdentityOther5): @" other5" ,
386+ @(MPIdentityOther6): @" other6" ,
387+ @(MPIdentityOther7): @" other7" ,
388+ @(MPIdentityOther8): @" other8" ,
389+ @(MPIdentityOther9): @" other9" ,
390+ @(MPIdentityOther10): @" other10" ,
391+ @(MPIdentityMobileNumber): @" mobile_number" ,
392+ @(MPIdentityPhoneNumber2): @" phone_number_2" ,
393+ @(MPIdentityPhoneNumber3): @" phone_number_3" ,
394+ @(MPIdentityIOSAdvertiserId): @" ios_idfa" ,
395+ @(MPIdentityIOSVendorId): @" ios_idfv" ,
396+ @(MPIdentityPushToken): @" push_token" ,
397+ @(MPIdentityDeviceApplicationStamp): @" device_application_stamp" };
398+
399+ return identityStrings[@(identityType)];
400+ }
401+
402+ + (NSNumber *)identityTypeForString : (NSString *)identityString {
403+ NSDictionary <NSString *, NSNumber *> *identityNumbers = @{@" customerid" : @(MPIdentityCustomerId),
404+ @" email" : @(MPIdentityEmail),
405+ @" facebook" : @(MPIdentityFacebook),
406+ @" facebookcustomaudienceid" : @(MPIdentityFacebookCustomAudienceId),
407+ @" google" : @(MPIdentityGoogle),
408+ @" microsoft" : @(MPIdentityMicrosoft),
409+ @" other" : @(MPIdentityOther),
410+ @" twitter" : @(MPIdentityTwitter),
411+ @" yahoo" : @(MPIdentityYahoo),
412+ @" other2" : @(MPIdentityOther2),
413+ @" other3" : @(MPIdentityOther3),
414+ @" other4" : @(MPIdentityOther4),
415+ @" other5" : @(MPIdentityOther5),
416+ @" other6" : @(MPIdentityOther6),
417+ @" other7" : @(MPIdentityOther7),
418+ @" other8" : @(MPIdentityOther8),
419+ @" other9" : @(MPIdentityOther9),
420+ @" other10" : @(MPIdentityOther10),
421+ @" mobile_number" : @(MPIdentityMobileNumber),
422+ @" phone_number_2" : @(MPIdentityPhoneNumber2),
423+ @" phone_number_3" : @(MPIdentityPhoneNumber3),
424+ @" ios_idfa" : @(MPIdentityIOSAdvertiserId),
425+ @" ios_idfv" : @(MPIdentityIOSVendorId),
426+ @" push_token" : @(MPIdentityPushToken),
427+ @" device_application_stamp" : @(MPIdentityDeviceApplicationStamp)};
428+
429+ return identityNumbers[identityString];
430+ }
431+
432+ + (NSNumber *)getRoktHashedEmailUserIdentityType {
433+ // Get the kit configuration
434+ NSArray <NSDictionary *> *kitConfigs = [MParticle sharedInstance ].kitContainer_PRIVATE .originalConfig .copy ;
435+ NSDictionary *roktKitConfig;
436+ for (NSDictionary *kitConfig in kitConfigs) {
437+ if (kitConfig[@" id" ] != nil && [kitConfig[@" id" ] integerValue ] == kMPRoktKitCode ) {
438+ roktKitConfig = kitConfig;
439+ }
443440 }
441+
442+ // Get the string representing which identity to use and convert it to the key (NSNumber)
443+ NSString *hashedIdentityTypeString = roktKitConfig[kMPHashedEmailUserIdentityType ];
444+ NSNumber *hashedIdentityTypeNumber = [MPKitRokt identityTypeForString: hashedIdentityTypeString.lowercaseString];
445+
446+ return hashedIdentityTypeNumber != nil ? hashedIdentityTypeNumber : @(MPIdentityOther);
444447}
445448
446449- (MPKitExecStatus *)purchaseFinalized : (NSString *)placementId catalogItemId : (NSString *)catalogItemId success : (NSNumber *)success {
0 commit comments