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", "PHP", 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, optional Dynamic customAttributes)
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 Array<Bool> getBoolArray (String name, Array<Bool> defaultValue, String userID, optional Dynamic customAttributes)
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 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 getBoolDictionary (String name, StringMap<Bool> defaultValue, String userID, optional Dynamic customAttributes)
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 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 Float getDouble (String name, Float defaultValue, String userID, optional Dynamic customAttributes)
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 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 Array<Float> getDoubleArray (String name, Array<Float> defaultValue, String userID, optional Dynamic customAttributes)
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 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 getDoubleDictionary (String name, StringMap<Float> defaultValue, String userID, optional Dynamic customAttributes)
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 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 Int getInt (String name, Int defaultValue, String userID, optional Dynamic customAttributes)
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 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 Array<Int> getIntArray (String name, Array<Int> defaultValue, String userID, optional Dynamic customAttributes)
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, StringMap<Int> defaultValue, String userID, optional Dynamic customAttributes)
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 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 String getString (String name, String defaultValue, String userID, optional Dynamic customAttributes)
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 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 Array<String> getStringArray (String name, Array<String> defaultValue, String userID, optional Dynamic customAttributes)
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 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 getStringDictionary (String name, StringMap<String> defaultValue, String userID, optional Dynamic customAttributes)
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 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 Array<VariantInfo> getVariantInfo (String userID, optional Dynamic customAttributes)
Returns information about all Experiments and Feature Flags 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 Bool isFeatureFlagEnabled (String name, String userID, optional Dynamic customAttributes)
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 Dynamic customAttributes)
Run a Code Block A/B Experiment for the specified user.
Parameters:
codeBlockVariableName | The Code Block Variable name from the experiment configuration. |
---|---|
callback | A dictionary of callback method pointers. The dictionary keys should be as follows:
|
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 setOnMetadataUpdatedCallback (OnMetadataProcessedCallback callback)
Set a callback method to be called when new metadata has been downloaded.
Parameters:
callback | Callback method to be called. Should have signature
|
---|
static Void setOnParticipationCallback (OnParticipationCallback callback)
Set a callback method to be called when the user has participated in an experiment.
Parameters:
callback | Callback method to be called. Should have signature
|
---|
static Void setup (String appKey, optional Dynamic configAttributes)
Setup Apptimize to receive metadata, track participation and events.
Parameters:
appKey | The app key for your application. Can be found here. |
---|---|
configAttribute | optional Configuration Attributes for Apptimize. |
static Void track (String eventName, String userID, optional Dynamic customAttributes)
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, optional Dynamic customAttributes)
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()
.