Skip to content

Commit

Permalink
Merge pull request #7 from taplytics/release/v2.3.0
Browse files Browse the repository at this point in the history
Updated Taplytics JS SDK to v2.3.0. Added FF support. [v2.3.0]
  • Loading branch information
Bwooks authored Apr 19, 2018
2 parents e5fa045 + b26f495 commit ce16bf2
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 5 deletions.
52 changes: 48 additions & 4 deletions EXPERIMENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ The type of the variable is defined by the type of the default value, and can be
For example, using a variable of type `Number`:

```javascript
Taplytics.variable("JS Number", 1, function(value) {
Taplytics.variable("JS Number", 1, (value) => {
// function called when experiment config has loaded and value has been set
console.log("JS Number value: " + value);
});
Expand All @@ -44,7 +44,7 @@ When the SDK has loaded the experiment config from our servers, the updated bloc
Due to the synchronous nature of the variable, if it is used before the experiments have been loaded from Taplytics servers, it's value will be the default value rather than the value set for that experiment. This could taint the results of the experiment. In order to prevent this you can ensure that the experiments are loaded before using the variable. This can be done using the `propertiesLoaded` method, as an example:

```javascript
Taplytics.propertiesLoaded(function() {
Taplytics.propertiesLoaded(() => {
var syncVar = Taplytics.variable("JS String", "default");
console.log("JS String Sync value: " + syncVar.value);
});
Expand Down Expand Up @@ -84,9 +84,7 @@ Taplytics.runningExperiments(function(expAndVars) {
//};
});
```

NOTE: The block can return asynchronously once Taplytics config has loaded. The block will return an Object with experiment names as the key values, and variation names as the values.

## Testing Experiments

To test/QA specific experiment and variation combinations use the `test_experiments` option with an Object containing keys of the experiment names, and values of variation names (or `baseline`).
Expand All @@ -99,3 +97,49 @@ Taplytics.init("API_KEY", {
}
});
```

## Feature Flags

Taplytics feature flags operate in synchronous mode.

### Synchronous

Synchronous feature flags are guaranteed to have the same value for the entire session and will have that value immediately after construction.

```
if (Taplytics.featureFlagEnabled("featureFlagKey")) {
//Put feature code here, or launch feature from here
}
```

Due to the synchronous nature of feature flags, if it is used before the feature flags have been loaded from Taplytics servers, it will default to as if the feature flag is not present. In order to prevent this you can ensure that the feature flags are loaded before using the feature flag. This can be done using the `propertiesLoaded` method, as an example:

```
Taplytics.propertiesLoaded((loaded) => {
if (Taplytics.featureFlagEnabled("featureFlagKey")) {
// Put feature code here, or launch feature from here
}
})
```

---

## Running Feature Flags

If you would like to see which feature flags are running, there exists a `getRunningFeatureFlags` function which provides a callback with an object that contains the currently active feature flags. An example:

```
Taplytics.getRunningFeatureFlags((runningFF) => {
// For example runningFF will contain:
// {
// "featureFlagKey": "My First Feature Flag",
// "key with spaces": "My Second Feature Flag"
// }
});
```

NOTE: The block can return asynchronously once Taplytics properties have loaded. The feature flags will be provided in an object where the properties are the
feature flag key names and their corresponding values are the names of the associated feature flags.

---

2 changes: 1 addition & 1 deletion taplytics.min.js

Large diffs are not rendered by default.

0 comments on commit ce16bf2

Please sign in to comment.