class Apptimize
Static methods
static Void flushTracking ()
Immediately send all tracked events and experiment participation to Apptimize's servers.
Apptimize will normally send all tracked events and experiment participation automatically on a regular schedule, however you can use this method to force events to be sent.
static String getApptimizeSDKPlatform ()
Get the name of the platform for this Apptimize SDK.
Returns:
The platform name (e.g. "JavaScript", "Python", etc).
static String getApptimizeSDKVersion ()
Get the current Apptimize SDK version for this platform.
Returns:
The Apptimize SDK version.
static Bool getBool (String name, Bool defaultValue, String userID, Dynamic customAttributes)
static Bool getBool (String name, Bool defaultValue, String userID)
Get a boolean Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or user is allocated to original variant. |
userID | User ID to use when running this experiment. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment. |
Returns:
The value of the Dynamic Variable.
static Dynamic getBoolArray (String name, Dynamic defaultValue, String userID, Dynamic customAttributes)
static Dynamic getBoolArray (String name, Dynamic defaultValue, String userID)
Get a boolean array Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Dynamic getBoolDictionary (String name, Dynamic defaultValue, String userID, Dynamic customAttributes)
static Dynamic getBoolDictionary (String name, Dynamic defaultValue, String userID)
Get a boolean dictionary Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment or Feature Variable. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Float getDouble (String name, Float defaultValue, String userID, Dynamic customAttributes)
static Float getDouble (String name, Float defaultValue, String userID)
Get a double-precision floating point number Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment or Feature Variable. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Dynamic getDoubleArray (String name, Dynamic defaultValue, String userID, Dynamic customAttributes)
static Dynamic getDoubleArray (String name, Dynamic defaultValue, String userID)
Get a double-precision floating point number array Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment or Feature Variable. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Dynamic getDoubleDictionary (String name, Dynamic defaultValue, String userID, Dynamic customAttributes)
static Dynamic getDoubleDictionary (String name, Dynamic defaultValue, String userID)
Get a double-precision floating point number dictionary Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable or user is allocated to original variant. |
userID | User ID to use when running this experiment or Feature Variable. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Int getInt (String name, Int defaultValue, String userID, Dynamic customAttributes)
static Int getInt (String name, Int defaultValue, String userID)
Get an integer Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Dynamic getIntArray (String name, Dynamic defaultValue, String userID, Dynamic customAttributes)
static Dynamic getIntArray (String name, Dynamic defaultValue, String userID)
Get an integer array Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or user is allocated to original variant. |
userID | User ID to use when running this experiment. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment. |
Returns:
The value of the Dynamic Variable.
static Dynamic getIntDictionary (String name, Dynamic defaultValue, String userID, Dynamic customAttributes)
static Dynamic getIntDictionary (String name, Dynamic defaultValue, String userID)
Get an integer dictionary Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment or Feature Variable. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Int getMetadataSequenceNumber ()
Returns the sequence number of the most recently downloaded metadata. Returns 0 if no metadata has been downloaded yet. For troubleshooting purposes.
static String getString (String name, String defaultValue, String userID, Dynamic customAttributes)
static String getString (String name, String defaultValue, String userID)
Get a string Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Dynamic getStringArray (String name, Dynamic defaultValue, String userID, Dynamic customAttributes)
static Dynamic getStringArray (String name, Dynamic defaultValue, String userID)
Get a string array Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment or Feature Variable. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Dynamic getStringDictionary (String name, Dynamic defaultValue, String userID, Dynamic customAttributes)
static Dynamic getStringDictionary (String name, Dynamic defaultValue, String userID)
Get a string dictionary Dynamic Variable for the specified user.
Parameters:
name | Name of the Dynamic Variable to retrieve. |
---|---|
defaultValue | Value to return if the Dynamic Variable is not set by an experiment or Feature Variable, or user is allocated to original variant. |
userID | User ID to use when running this experiment or Feature Variable. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment or Feature Variable. |
Returns:
The value of the Dynamic Variable.
static Dynamic getVariantInfo (String userID, Dynamic customAttributes)
static Dynamic getVariantInfo (String userID)
Returns information about all Experiments, Feature Flags, and Feature Variables that the user is eligible to participate in. The list includes all of the variants that the user is allocated to (and does NOT include information about Experiments and Feature Flags the user is not eligible for).
Parameters:
userID | User ID to find list of variants for. |
---|---|
customAttributes | optional Custom Attributes dictionary to be used to find variants. |
Returns:
A list of VariantInfo objects.
static Dynamic getWinnerVariantInfo (String userID, Dynamic customAttributes)
static Dynamic getWinnerVariantInfo (String userID)
Returns information about all Winning Experiments that the user is eligible to participate in. The list includes all of the winning variants that the user is allocated to (and does NOT include information about Experiments and Feature Flags the user is not eligible for).
Parameters:
userID | User ID to find list of variants for. |
---|---|
customAttributes | optional Custom Attributes dictionary to be used to find variants. |
Returns:
A list of WinnerVariantInfo objects.
static Bool isFeatureFlagEnabled (String name, String userID, Dynamic customAttributes)
static Bool isFeatureFlagEnabled (String name, String userID)
Detect if a Feature Flag is enabled for the specified user.
Parameters:
name | The Feature Flag Variable name. |
---|---|
userID | User ID to use for this feature flag. |
customAttributes | optional Custom Attributes dictionary to be used for this feature flag. |
Returns:
true
if the Feature Flag is enabled; false
otherwise.
static Void runCodeBlock (String codeBlockVariableName, Dynamic callback, String userID, optional Null< Dynamic > customAttributes)
static Void runCodeBlock (String codeBlockVariableName, Dynamic callback, String userID)
Run a Code Block A/B Experiment for the specified user.
Parameters:
codeBlockVariableName | The Code Block Variable name from the experiment configuration. |
---|---|
callback | A callback object with appropriately named methods:
|
userID | User ID to use when running this experiment. |
customAttributes | optional Custom Attributes dictionary to be used for this experiment. |
static Void setAppName (String name)
Set the app name for the current session. Used for targeting and results filtering.
Parameters:
name | A valid string name for the application. |
---|
static Void setAppVersion (String version)
Set the app version for the current session. Used for targeting and results filtering.
Parameters:
version | A Semantic Versioning 2.0 valid version. See Semantic Versioning. |
---|
static Void setOnApptimizeInitializedCallback ( Dynamic callback)
Set a callback listener to be called when Apptimize is fully initialized, metadata is downloaded, and tests are available.
Parameters:
callback | OnApptimizeInitializedListener to be called. Must override
|
---|
static Void setOnMetadataUpdatedCallback ( Dynamic callback)
Set a callback listener to be called when new metadata has been downloaded.
Parameters:
callback | OnMetadataUpdatedListener to be called. Must override
|
---|
static Void setOnParticipatedInExperimentCallback ( Dynamic callback)
Set a callback listener to be called when the user has participated in an experiment.
Parameters:
callback | OnParticipatedInExperimentListener to be called. Must override
|
---|
static Void setOnParticipationCallback ( Dynamic callback)
Method deprecated, please use setOnParticipatedInExperimentCallback instead.
Set a callback listener to be called when the user has participated in an experiment.
Parameters:
callback | OnParticipationListener object to be called. Must override
|
---|
static Void setup (String appKey, Dynamic configAttributes)
static Void setup (String appKey)
Setup Apptimize to receive metadata, track participation and events.
Parameters:
appKey | The app key for your application. Can be found here. |
---|---|
configAttributes | optional A dictionary of Configuration Attributes for Apptimize.
|
static Void shutdown ()
Shutdown Apptimize.
Saves all cached data into high latency memory including metadata and results. Stops sending and receiving all data. Should only be called from the main thread!
static Void track (String eventName, String userID, Dynamic customAttributes)
static Void track (String eventName, String userID)
Track an event for the user.
Parameters:
eventName | Name of the event. |
---|---|
userID | The User ID. |
customAttributes | optional Custom Attributes dictionary for the event. |
static Void trackValue (String eventName, Float value, String userID, Dynamic customAttributes)
static Void trackValue (String eventName, Float value, String userID)
Track an event for the user with a value.
Parameters:
eventName | Name of the event. |
---|---|
value | A double-precision floating point number value to track with the event. |
userID | The User ID. |
customAttributes | optional Custom Attributes dictionary for the event. |
static Void updateApptimizeMetadataOnce ()
Force an update of the application metadata.
Can be useful for testing to get an update before Apptimize would automatically check for an update. If a new
update is found, Apptimize will dispatch an event callback to the method set in setOnMetadataUpdatedCallback()
.