A/B Testing and Feature Management

Our SDK helps you decouple product experiences from code on your application in real-time with product variables. These product variables let you change the application's behavior and appearance without requiring users to download an app update.

When using this feature, you essentially create product variables and their default values that control the app's behavior and appearance. You can later use the Product Experience dashboard to change these default values and update product variables for all segments of your web user base.

This guide helps you with the steps related to product variables. Product variables for a given feature are configs having a key name, default value, and defined data type.

Type of Product Variables

Let's first understand product variables and their types.

Type of Product VariableWhat is it?When to choose this?
StringThis product variable is simply a collection of characters and numbers that helps you to perform text-based changes in run-time.Whenever you are customizing the content of your app or website, you can choose _string _product variable type.
NumberNumber product variables are used to define decimal or integer values.If you are about to make numeric changes in your app or website, select a Number product variable type.
BooleanThis product variable is used to represent one of the two values - True or False.When you to want to turn OFF/ ON the features and functions of your app or website, do it in one stroke with a Boolean product variable type.
JSONThis product variable is a collection of Key-Value pairs used to define an object for structuring data.You can use JSON product variable type for managing entire data sets from Hansel dashboard in order to store and organize site or app content for e.g while creating a homepage.

Step 1. Create Product Variables

  1. Navigate to the Product Variables section from the left menu
  1. Click Create Feature Module button. A feature module refers to a particular feature where you want to define certain product variables. As an example, let's take the example of "Wishlist" as a feature module.
  1. Once you are done creating a feature module, you can start adding product variables. Product variable consists of a key name, the data type of its value such as string, number, boolean, and json, and the default value for this key.

Continuing our example of "Wishlist" feature module, the below screenshot shows how we can add product variable "wishlist_feature_enabled" having boolean datatype and default value as false.

📘

NOTE

  • In a similar manner, you can add multiple product variables to the given feature module.
  • Otherwise, you can also create unassigned product variables, and add them to any already added feature module later on.
  • You can also optionally enter a short “Description” for these product variables.

Step 2. Using product variables from the dashboard in your app

Once you are done with the above step of creating the product variables, you need to implement the below code snippets based on the applicable data type and relevant feature module where you want to add these product variables.

📘

Note

Note following parameters when it comes to adding below mentioned code snippets to your website

  • key : This is the name of the product variable on the Netcore Product Experience Dashboard
  • fallbackValue(optional) : This is a fallback value to use if the key doesn't exist or the connection with the Netcore backend hasn't been established. Although fallback value is optional it is recommended that you provide one.

1. Fetching the boolean product variable
To get the value of a boolean product variable, the following is what you need to do:

//Use the product variable you created on the dashboard
bool value = await NetcorePX.instance.getBoolean(key, true);

//Use featureEnabled to show/hide the feature

2. Fetching the string product variable

To get the value of a string product variable, you need to do the following:

//Use the product variable you created on the dashboard
String value = await NetcorePX.instance.getString(key, "defaultValue");

3. Fetching the Double or Number product variable
To get the value of a number product variable, you need to do the following:

//Use the product variable you created on the dashboard
int value = await NetcorePX.instance.getInt(key, 0);

double value = await NetcorePX.instance.getDouble(key, 0.0);

4. Fetching the Json Object product variable

To get the value of a JSON product variable, you need to do the following:

//Use the product variable you created on the dashboard
Object value = await NetcorePX.instance.getJSONObject(key, jsonObject);

Object value = await NetcorePX.instance.getJSONArray(key, json);

Next

For more information, visit these links.