Services in personalizationservices Extension
The personalizationservices extension provides basic services to execute the data model operations.
The sections below provide you with details on each service.
CX Service
The CxService is the main entry point for enabling personalization for customers. This service calculates actions for a given customer and executes them by creating immutable action results related to a particular customer. The CxService is reponsible for the following functionality:
- triggering of asynchronous processes to calculate user segmentation and experience
- synchronous calculation of user experience
Segment Service
The CxSegmentService provides methods for searching segments and users related to segments. The CxSegmentServices uses the CxUserSegmentService and CxUserSegmentSessionService to manage the user to segment relation. For details on these two services, see the sections below.
Additionally, the CxSegmentService handles functionality for updating segments definition and assigning segments to the customer. The update segments process is defined in the UpdateSegmentStrategy. Assigning segments to the customer is defined in the UpdateUserSegmentStrategy.
A default implementation of the UpdateUserSegmentStrategy has been defined in the personalizationintegration extension. Its task is to update the user segments based on information collected from providers. For more information, see personalizationintegration Extension.
To update the information about the user segments you can create a custom provider or your own implementation of this strategy. By default, the user segments are being updated in an asynchronous process when a user logs in, but it can be also configured in a different manner - for example synchronously.
Consider this fact when you create your own provider or implementation of the UpdateUserSegmentStrategy. If it uses data from external system, it should be able to handle connection problems without significant influence on the performance.
Update Segment Strategy
The update segments process is defined in the UpdateSegmentStrategy, which provides segments definitions.
It contains the updateSegments method. This method uses the CxUpdateSegmentContext parameter to control the segment update process.
The CxUpdateSegmentContext parameter contains the following fields:
- segmentProviders: a set of strings that specify which providers are used for the update.
- fullUpdate: a boolean flag. Setting the flag to true results in a full update, which also means removing the non-existing segments. Setting the flag to false results in adding only the new segments.
- baseSites: a set of BaseSiteModel objects, controlling which base sites or tenants are used for the update.
The personalizationservices extension contains EmptyUpdateSegmentStrategy, which is an empty implementation of the UpdateSegmentStrategy.
A default implementation of the UpdateSegmentStrategy interface is defined in the personalizationintegration extension. Its task is to update segments definitions based on the information collected from providers. For more information, see Default Update Segment Strategy.
Update User Segment Strategy
The process for updating customer segments is defined in the UpdateUserSegmentStrategy. It provides segments for a given customer.
The strategy contains the updateUserSegments method. This method uses the CxCalculationContext parameter to control the customer segment update process. The context stores a list of providers, which should be asked for customer segments.
The personalizationservices extension contains the empty implementation of the UpdateUserSegmentStrategy.
A default implementation of the UpdateUserSegmentStrategy has been defined in the personalizationintegration extension. Its task is to update the customer segments based on the information collected from providers. For more information, see Default Update User Segment Strategy.
User Segment Service
The CxUserSegmentService provides the functionality used to manage the models representing the user-to-segment relations. It includes the methods for setting, adding and removing the user-to-segment relations.
User Segment Session Service
The CxUserSegmentSessionService provides the functionality used to manage the data representing user to segment relations. It provides methods for setting, adding and removing the user-to-segment relations within the scope of a session.
This service is used mostly for anonymous users. It can also be used for registered user segments, provided they are configured to be stored in session. You can configure this option by setting the userSegmentsStoreInSession property under in the Backoffice Administration Cockpit. For details, see Set Up a Personalization Configuration.
Customization Service
A customization groups personalization variations intended for a common purpose. It can represent a specific campaign such as a Summer Sale. Only one variation per customization can be active for a user at a given time. The CxCustomizationService contains functionality for managing the customizations. It provides methods for searching and creating customizations.
Variation Service
A variation groups actions executed to customize the user experience. The CxVariationService contains functionality for managing the variations. It provides methods for searching and creating variations.
Action Service
The action object contains information about an action, which should be executed to customize the user experience. The CxActionService contains functionality for managing actions. It provides methods for searching and creating actions.
Action Result Service
The action result objects store information, which is required to customize the user experience. The CxActionResultService contains functionality for managing action results. By default, the action results are stored in session. This can be changed by providing custom implementation of the CxActionResultService.
Configuration Service
The default CxConfigurationService implementation provides an entry point for retrieving the global personalization configuration for a base site. To maintain the backward compatibility, a fallback mechanism for getting the configuration based on the *.property file has been implemented. For details on personalization configuration see: Configure Personalization.
Process Service
- creating and starting personalization asynchronous process,
- loading and storing parameters for the process using the strategies described in the section below. The process parameters are always loaded all at once, however you can decide either to store all of them or just the selected ones. The CxProcessParameterType enumeration defines the default values.
Loading and Storing Parameters
- CxProcessParameterAnonymousSegmentationStrategy, which stores anonymous segmentation as a process parameter or loads it from the process and sets it using the cxSegmentService.
- CxProcessParameterBaseSiteStrategy, which stores the current base site as a process parameter or loads it from a process and sets it in session using the BaseSiteService.
- CxProcessParameterSessionTokenStrategy, which stores the session token and the session token key as a process parameter or loads them from the process and sets both of them in session (using SessionService and CxSessionTokenStrategy).
Each of these strategies implements the load and store functions and defines (in the spring context) the supported parameters.

