Description
Messages collapse window size is nothing but a way to compose Notification Tags in a manner that allows grouping notifications together on the client side with predefined number.
When multiple notifications with the same tag are sent, the browser will typically display only the most recent notification, replacing any previous ones with the same tag. This helps to avoid overwhelming users with too many notifications and ensures that they see the most relevant information.
Implementation
This feature is mostly controlled by campaign.iter_cycle attribute that is either:
- defined explicitly by the user when creating a campaign
- is derived from the poly-campaign-map (by setting it to the number of configured poly campaign iterations)
Server-side calculation
In the first case, the iter_cycle value will be calculated on the server side with a simple logic that will add an incrementing counter to the base tag value until it reaches the defined iter_cycle value, after which it will reset back to zero.
Client-side calculation
In the second case, though, the iter_cycle should be calculated on the client side, since the server is not aware of the number of iterations that will be performed by the poly campaign for each user. This is happening because some users might receive only a subset of all poly campaign iterations based on their segmentation attributes. Therefore, a centralized server-side calculation of the iter_cycle would not be accurate in this scenario.
In order to activate client-side calculation, the following environment variable should be set for the directory-messages:
MESSAGES_INCLUDE_COLLAPSE_TAG_SUFFIX: "0"