Default Update User Segment Strategy
The DefaultCxUpdateUserSegmentStrategy is the default implementation of the UpdateUserSegmentStrategy, defined in the personalizationintegration extension.
The strategy allows to update segments from several external systems at the same time. The DefaultCxUpdateUserSegmentStrategy collects the segments from the implementations of the UserSegmentsProvider defined in the Spring context and assigns the segments to the user. If there are no segments in the system, they can be created if the Auto Create Segments flag is set to true. If it's set to false, the strategy does not set any user to segment relation.
You can change this behavior in the Backoffice Administration Cockpit under . For details on how to manage the configuration, see Set Up a Personalization Configuration.
personalizationintegration.updateUserSegment.createSegment=true
User Segments Provider
The UserSegmentsProvider is an interface which should be implemented when connecting another source of user segments.
- getUserSegments - returning segments for user,
- getProviderId - returning provider identifier. This method has a default implementation which classifies provider as one of the DEFAULT providers.
Provider identifier allows to:
- configure how often provider is called on update user segment process. For details, see Configure a Segment.
- configure the prefix for segments returned by provider. For details, see Define Simple User Segments Provider.
/**
* Interface returning segments assigned to user
*/
public interface UserSegmentsProvider
{
String DEFAULT_PROVIDER_ID = "DEFAULT";
/**
* Method returning segments assigned to user
*
* @param user
* User model
* @return segments assigned to user or null if segments should not be updated
*/
List<SegmentMappingData> getUserSegments(final UserModel user);
/**
* Method returns provider identifier
*
* @return - provider identifier
* @since 1811
*/
default String getProviderId()
{
return DEFAULT_PROVIDER_ID;
}
}
- UserTypeSegmentsProvider - providing segments to distinguish anonymous and registered users.
- ConsumptionLayerUserSegmentsProvider - providing segments from Intelligent Selling Services Foundation.
Provider Prefix
personalizationintegration.provider.SAMPLEID.prefix=PREF
Provider Separator
By default, the separator between prefix and segment code is set as space. To set a different separator, use the personalizationintegration.provider.<PROVIDER_ID>.separator property.
UserTypeSegmentsProvider
- USER_ANONYMOUS
- USER_REGISTERED
The UserTypeSegmentsProvider has a DEFAULT provider identifier. This means it uses the segment prefix configured for DEFAULT providers (personalizationintegration.provider.DEFAULT.prefix) and it is called during the update, update_default, or async process actions. This means that depending on the personalization configuration, USER_ANONYMOUS and USER_REGISTERED may not be updated right away when user starts the session or logs in.
- when defining the calculation settings in the Backoffice Administration Cockpit, set the update action to be executed at the beginning of the session and during logon. For details, see the Initial Actions section in Configure Personalization Calculation.
- when defining the target group expression in SmartEdit, use only USER_REGISTERED or NOT (USER_REGISTERED) options. For details, see Add Customizations.
This behavior reduces instances when the given target group is not triggered.
Define Segments Provider
Context
You can create your own provider used by the DefaultCxUpdateUserSegmentStrategy.
Procedure
Auto Creation of Segments
In the personalizationintegration extension, the CxConfig was extended to include the autoCreateSegments parameter.
If it is set to true in the Backoffice Administration Cockpit, the segments are automatically created from the external data during update. To allow enabling the auto creation of segments in the Backoffice Administration Cockpit, the personalizationintegration extension was extended with the backoffice configuration.

