@@ -42,7 +42,8 @@ type OptimizelyClient struct {
42
42
executionCtx utils.ExecutionCtx
43
43
}
44
44
45
- // Activate returns the key of the variation the user is bucketed into and sends an impression event to the Optimizely log endpoint
45
+ // Activate returns the key of the variation the user is bucketed into and queues up an impression event to be sent to
46
+ // the Optimizely log endpoint for results processing.
46
47
func (o * OptimizelyClient ) Activate (experimentKey string , userContext entities.UserContext ) (result string , err error ) {
47
48
48
49
defer func () {
@@ -77,7 +78,8 @@ func (o *OptimizelyClient) Activate(experimentKey string, userContext entities.U
77
78
return result , err
78
79
}
79
80
80
- // IsFeatureEnabled returns true if the feature is enabled for the given user
81
+ // IsFeatureEnabled returns true if the feature is enabled for the given user. If the user is part of a feature test
82
+ // then an impression event will be queued up to be sent to the Optimizely log endpoint for results processing.
81
83
func (o * OptimizelyClient ) IsFeatureEnabled (featureKey string , userContext entities.UserContext ) (result bool , err error ) {
82
84
83
85
defer func () {
@@ -122,7 +124,8 @@ func (o *OptimizelyClient) IsFeatureEnabled(featureKey string, userContext entit
122
124
return result , err
123
125
}
124
126
125
- // GetEnabledFeatures returns an array containing the keys of all features in the project that are enabled for the given user.
127
+ // GetEnabledFeatures returns an array containing the keys of all features in the project that are enabled for the given
128
+ // user. For features tests, impression events will be queued up to be sent to the Optimizely log endpoint for results processing.
126
129
func (o * OptimizelyClient ) GetEnabledFeatures (userContext entities.UserContext ) (enabledFeatures []string , err error ) {
127
130
128
131
defer func () {
@@ -156,7 +159,7 @@ func (o *OptimizelyClient) GetEnabledFeatures(userContext entities.UserContext)
156
159
return enabledFeatures , err
157
160
}
158
161
159
- // GetFeatureVariableBoolean returns boolean feature variable value
162
+ // GetFeatureVariableBoolean returns the feature variable value of type bool associated with the given feature and variable keys.
160
163
func (o * OptimizelyClient ) GetFeatureVariableBoolean (featureKey , variableKey string , userContext entities.UserContext ) (value bool , err error ) {
161
164
162
165
val , valueType , err := o .GetFeatureVariable (featureKey , variableKey , userContext )
@@ -170,7 +173,7 @@ func (o *OptimizelyClient) GetFeatureVariableBoolean(featureKey, variableKey str
170
173
return convertedValue , err
171
174
}
172
175
173
- // GetFeatureVariableDouble returns double feature variable value
176
+ // GetFeatureVariableDouble returns the feature variable value of type double associated with the given feature and variable keys.
174
177
func (o * OptimizelyClient ) GetFeatureVariableDouble (featureKey , variableKey string , userContext entities.UserContext ) (value float64 , err error ) {
175
178
176
179
val , valueType , err := o .GetFeatureVariable (featureKey , variableKey , userContext )
@@ -184,7 +187,7 @@ func (o *OptimizelyClient) GetFeatureVariableDouble(featureKey, variableKey stri
184
187
return convertedValue , err
185
188
}
186
189
187
- // GetFeatureVariableInteger returns integer feature variable value
190
+ // GetFeatureVariableInteger returns the feature variable value of type int associated with the given feature and variable keys.
188
191
func (o * OptimizelyClient ) GetFeatureVariableInteger (featureKey , variableKey string , userContext entities.UserContext ) (value int , err error ) {
189
192
190
193
val , valueType , err := o .GetFeatureVariable (featureKey , variableKey , userContext )
@@ -198,7 +201,7 @@ func (o *OptimizelyClient) GetFeatureVariableInteger(featureKey, variableKey str
198
201
return convertedValue , err
199
202
}
200
203
201
- // GetFeatureVariableString returns string feature variable value
204
+ // GetFeatureVariableString returns the feature variable value of type string associated with the given feature and variable keys.
202
205
func (o * OptimizelyClient ) GetFeatureVariableString (featureKey , variableKey string , userContext entities.UserContext ) (value string , err error ) {
203
206
204
207
value , valueType , err := o .GetFeatureVariable (featureKey , variableKey , userContext )
@@ -211,7 +214,7 @@ func (o *OptimizelyClient) GetFeatureVariableString(featureKey, variableKey stri
211
214
return value , err
212
215
}
213
216
214
- // GetFeatureVariable returns feature as a string along with it's associated type
217
+ // GetFeatureVariable returns feature variable as a string along with it's associated type.
215
218
func (o * OptimizelyClient ) GetFeatureVariable (featureKey , variableKey string , userContext entities.UserContext ) (value string , valueType entities.VariableType , err error ) {
216
219
217
220
featureDecisionContext , featureDecision , err := o .getFeatureDecision (featureKey , variableKey , userContext )
@@ -230,7 +233,7 @@ func (o *OptimizelyClient) GetFeatureVariable(featureKey, variableKey string, us
230
233
return variable .DefaultValue , variable .Type , err
231
234
}
232
235
233
- // GetAllFeatureVariables returns all the variables for a given feature along with the enabled state
236
+ // GetAllFeatureVariables returns all the variables for a given feature along with the enabled state.
234
237
func (o * OptimizelyClient ) GetAllFeatureVariables (featureKey string , userContext entities.UserContext ) (enabled bool , variableMap map [string ]string , err error ) {
235
238
236
239
variableMap = make (map [string ]string )
@@ -263,7 +266,7 @@ func (o *OptimizelyClient) GetAllFeatureVariables(featureKey string, userContext
263
266
return enabled , variableMap , err
264
267
}
265
268
266
- // GetVariation returns the key of the variation the user is bucketed into
269
+ // GetVariation returns the key of the variation the user is bucketed into. Does not generate impression events.
267
270
func (o * OptimizelyClient ) GetVariation (experimentKey string , userContext entities.UserContext ) (result string , err error ) {
268
271
269
272
defer func () {
@@ -294,7 +297,8 @@ func (o *OptimizelyClient) GetVariation(experimentKey string, userContext entiti
294
297
return result , err
295
298
}
296
299
297
- // Track take and event key with event tags and if the event is part of the config, send to events backend.
300
+ // Track generates a conversion event with the given event key if it exists and queues it up to be sent to the Optimizely
301
+ // log endpoint for results processing.
298
302
func (o * OptimizelyClient ) Track (eventKey string , userContext entities.UserContext , eventTags map [string ]interface {}) (err error ) {
299
303
300
304
defer func () {
@@ -427,7 +431,7 @@ func (o *OptimizelyClient) getExperimentDecision(experimentKey string, userConte
427
431
return decisionContext , experimentDecision , err
428
432
}
429
433
430
- // GetProjectConfig returns the current ProjectConfig or nil if the instance is not valid
434
+ // GetProjectConfig returns the current ProjectConfig or nil if the instance is not valid.
431
435
func (o * OptimizelyClient ) GetProjectConfig () (projectConfig pkg.ProjectConfig , err error ) {
432
436
433
437
projectConfig , err = o .ConfigManager .GetConfig ()
@@ -438,7 +442,7 @@ func (o *OptimizelyClient) GetProjectConfig() (projectConfig pkg.ProjectConfig,
438
442
return projectConfig , nil
439
443
}
440
444
441
- // Close closes the Optimizely instance and stops any ongoing tasks from its children components
445
+ // Close closes the Optimizely instance and stops any ongoing tasks from its children components.
442
446
func (o * OptimizelyClient ) Close () {
443
447
o .executionCtx .TerminateAndWait ()
444
448
}
0 commit comments