Segmentation

Segmentation allows you to target specific groups of users. Each widget's payload includes a segmentation rule, which is evaluated against your user's profile data. If a user's profile meets the segmentation rule criteria, the widget is displayed.

Key requirements for segmentation

Reflection of available user data

For the segmentation feature to work correctly an example of the available user data needs to be reflected in the CMS. Importance here is that attribute and example value are named correctly and represent the type (see example below). This allows you to create targets and apply rules for each target individually.

Example: Available user data

This example shows that an attribute country of type string is available and can be used to build segmentation rules when creating targets.

{
  "country": "AT",
	"age": 30
}

Setting user profile data

In order to be able to compare segmentation rules, user data should be set through the SDK for the current user.

const userData = {
  country: "AT",
  age: "35",
};
const updatedProfile = await embet.updateProfileData(userData);

📘

For a better understanding of how the emBET User Profile works, please read the User Profiles section.

📘

Recommended best practice

For the correct functioning of the Segmentation, the User Profile's location must be checked and in case updated at every access
E.g. A user accessing for the first time in Austria will have this country assigned as location, although if the user would accesses another time from a different location, that must be updated in the user profile, otherwise, the segmentation rules would not work adequately and the widgets might not show up.


Updating Profile Data

The profile segmentation data can be updated at any time using embet.updateProfileData(userData). This method receives the user data object as a parameter and returns a Promise which resolves in an updated emBET profile object.

const userData = {
  country: "US",
  lang: "EN",
  age: "28",
}
const updatedProfile = await embet.updateProfileData(userData);
📘

The emBET SDK must be initialized to use updateProfileData.