@@ -39,7 +39,7 @@ export class Experiment {
3939    const  currentActiveExperiments  = 
4040      ( await  this . storage . getActiveExperiments ( ) )  ||  new  Set < string > ( ) ; 
4141    const  experimentInfoMap  =  this . createExperimentInfoMap ( latestExperiments ) ; 
42-     this . addActiveExperiments ( currentActiveExperiments ,   experimentInfoMap ) ; 
42+     this . addActiveExperiments ( experimentInfoMap ) ; 
4343    this . removeInactiveExperiments ( currentActiveExperiments ,  experimentInfoMap ) ; 
4444    return  this . storage . setActiveExperiments ( new  Set ( experimentInfoMap . keys ( ) ) ) ; 
4545  } 
@@ -55,14 +55,11 @@ export class Experiment {
5555  } 
5656
5757  private  addActiveExperiments ( 
58-     currentActiveExperiments : Set < string > , 
5958    experimentInfoMap : Map < string ,  FirebaseExperimentDescription > 
6059  ) : void   { 
6160    const  customProperty : Record < string ,  string  |  null >  =  { } ; 
6261    for  ( const  [ experimentId ,  experimentInfo ]  of  experimentInfoMap . entries ( ) )  { 
63-       if  ( ! currentActiveExperiments . has ( experimentId ) )  { 
64-         customProperty [ experimentId ]  =  experimentInfo . variantId ; 
65-       } 
62+       customProperty [ `firebase${ experimentId }  ` ]  =  experimentInfo . variantId ; 
6663    } 
6764    this . addExperimentToAnalytics ( customProperty ) ; 
6865  } 
@@ -74,7 +71,7 @@ export class Experiment {
7471    const  customProperty : Record < string ,  string  |  null >  =  { } ; 
7572    for  ( const  experimentId  of  currentActiveExperiments )  { 
7673      if  ( ! experimentInfoMap . has ( experimentId ) )  { 
77-         customProperty [ experimentId ]  =  null ; 
74+         customProperty [ `firebase ${ experimentId } ` ]  =  null ; 
7875      } 
7976    } 
8077    this . addExperimentToAnalytics ( customProperty ) ; 
@@ -89,7 +86,8 @@ export class Experiment {
8986    try  { 
9087      const  analytics  =  this . analyticsProvider . getImmediate ( {  optional : true  } ) ; 
9188      if  ( analytics )  { 
92-         analytics . setUserProperties ( {  properties : customProperty  } ) ; 
89+         analytics . setUserProperties ( customProperty ) ; 
90+         analytics . logEvent ( `set_firebase_experiment_state` ) ; 
9391      }  else  { 
9492        this . logger . warn ( `Analytics import failed` ) ; 
9593      } 
0 commit comments