@@ -25,7 +25,6 @@ var constructor = function () {
2525
2626 self . launcher = null ;
2727 self . filters = { } ;
28- self . filteredUser = { } ;
2928 self . userAttributes = { } ;
3029
3130 /**
@@ -115,31 +114,17 @@ var constructor = function () {
115114 console . warn ( 'Unable to find Rokt on the page' ) ;
116115 }
117116 }
118-
119117 /**
120- * Adds user identities to the attributes object
121- * @param {Object } attributes - The attributes object to add identities to
118+ * Returns the user identities from the filtered user, if any
122119 * @param {Object } filteredUser - The filtered user object containing identities
123- * @returns {Object } The attributes object with added identities
120+ * @returns {Object } The user identities from the filtered user
124121 */
125- function addIdentityAttributes ( attributes , filteredUser ) {
122+ function returnUserIdentities ( filteredUser ) {
126123 if ( ! filteredUser || ! filteredUser . getUserIdentities ) {
127- return attributes ;
128- }
129-
130- var userIdentities = filteredUser . getUserIdentities ( ) . userIdentities ;
131- if ( ! userIdentities ) {
132- return attributes ;
133- }
134-
135- for ( var identityKey in userIdentities ) {
136- if ( userIdentities . hasOwnProperty ( identityKey ) ) {
137- var identityValue = userIdentities [ identityKey ] ;
138- attributes [ identityKey ] = identityValue ;
139- }
124+ return { } ;
140125 }
141126
142- return attributes ;
127+ return filteredUser . getUserIdentities ( ) . userIdentities ;
143128 }
144129
145130 /**
@@ -186,14 +171,11 @@ var constructor = function () {
186171 ? fetchOptimizely ( )
187172 : { } ;
188173
189- // Add user identities to the attributes
190- filteredAttributes = addIdentityAttributes (
191- filteredAttributes ,
192- filteredUser
193- ) ;
174+ var filteredUserIdentities = returnUserIdentities ( filteredUser ) ;
194175
195176 var selectPlacementsAttributes = mergeObjects (
196177 filteredAttributes ,
178+ filteredUserIdentities ,
197179 optimizelyAttributes ,
198180 {
199181 mpid : mpid ,
@@ -208,7 +190,6 @@ var constructor = function () {
208190 }
209191
210192 function onUserIdentified ( filteredUser ) {
211- self . filteredUser = filteredUser ;
212193 self . filters . filteredUser = filteredUser ;
213194 self . userAttributes = filteredUser . getAllUserAttributes ( ) ;
214195 }
@@ -246,8 +227,6 @@ var constructor = function () {
246227 console . warn (
247228 'Rokt Kit: No filtered user has been set.'
248229 ) ;
249- } else {
250- self . filteredUser = roktFilters . filteredUser ;
251230 }
252231 }
253232 // Attaches the kit to the Rokt manager
0 commit comments