The 5.7 branch of Magnolia reached End-of-Life on December 31, 2023, as specified in our End-of-life policy. This means the 5.7 branch is no longer maintained or supported. Please upgrade to the latest Magnolia release. By upgrading, you will get the latest release of Magnolia featuring significant improvements to the author and developer experience. For a successful upgrade, please consult our Magnolia 6.2 documentation. If you need help, please contact info@magnolia-cms.com.

Magnolia's cookie trait Cookies reads data from cookies with the CookieParameterConverter and uses the CookieVoter to render the appropriate content variation according to configuration.

The cookies trait and all its classes are part of the magnolia-personalization-traits submodule  which is installed with the Personalization module. The cookie trait supports multiple cookies. You can configure as many cookies as you like for multiple use cases and use them simultaneously. 

magnolia-personalization-traits installs a default configuration. You can add your own cookies by defining custom options in the:

The configuration is in /modules/personalization-traits/traits/cookies. Use the Configuration app to edit.

Node nameValue

 
personalization-traits


 
traits


 
cookies


 
ruleField


 
valueField


 
converterClass

info.magnolia.personalization.cookie.CookieParameterConverter

 
defaultPreviewTrait

false

 
defaultRuleTrait

false

 
traitClass

info.magnolia.personalization.cookie.Cookies

 
voterClass

info.magnolia.personalization.cookie.CookieVoter

Properties: 

<cookie>

required

Trait name.

ruleField

required

Field used to define permitted values for the trait. See Configuring the rule field below.

valueField

required

Field used to set permitted values for personalized content delivery. See Configuring the value field below.

converterClass

required

CookieParameterConverter : Cookie parameter converter.

defaultPreviewTrait

optionaldefault is false

Displays all cookie trait options in the Preview app by default when set to true.

defaultRuleTrait

optional. default is false

<insert>

traitClass

required

Cookies : Specifies the cookie trait.

voterClass

required

CookieVoter : Matches the cookie name to the cookie value. See Voters.