Magnolia 5.7 reached extended end of life on May 31, 2022. Support for this branch is limited, see End-of-life policy. Please note that to cover the extra maintenance effort, this EEoL period is a paid extension in the life of the branch. Customers who opt for the extended maintenance will need a new license key to run future versions of Magnolia 5.7. If you have any questions or to subscribe to the extended maintenance, please get in touch with your local contact at Magnolia.

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.