@@ -37,8 +37,12 @@ class OptimizelyUserContext:
3737 """
3838
3939 def __init__ (
40- self , optimizely_client : optimizely .Optimizely , logger : Logger ,
41- user_id : str , user_attributes : Optional [UserAttributes ] = None
40+ self ,
41+ optimizely_client : optimizely .Optimizely ,
42+ logger : Logger ,
43+ user_id : str ,
44+ user_attributes : Optional [UserAttributes ] = None ,
45+ identify : bool = True
4246 ):
4347 """ Create an instance of the Optimizely User Context.
4448
@@ -47,6 +51,7 @@ def __init__(
4751 logger: logger for logging
4852 user_id: user id of this user context
4953 user_attributes: user attributes to use for this user context
54+ identify: True to send identify event to ODP.
5055
5156 Returns:
5257 UserContext instance
@@ -67,7 +72,7 @@ def __init__(
6772 OptimizelyUserContext .OptimizelyForcedDecision
6873 ] = {}
6974
70- if self .client :
75+ if self .client and identify :
7176 self .client .identify_user (user_id )
7277
7378 class OptimizelyDecisionContext :
@@ -94,7 +99,13 @@ def _clone(self) -> Optional[OptimizelyUserContext]:
9499 if not self .client :
95100 return None
96101
97- user_context = OptimizelyUserContext (self .client , self .logger , self .user_id , self .get_user_attributes ())
102+ user_context = OptimizelyUserContext (
103+ self .client ,
104+ self .logger ,
105+ self .user_id ,
106+ self .get_user_attributes (),
107+ identify = False
108+ )
98109
99110 with self .lock :
100111 if self .forced_decisions_map :
0 commit comments