Magnolia 5.3 reached end of life on June 30, 2017. This branch is no longer supported, see End-of-life policy.
In this tutorial you learn how to personalize content. You will target content to visitors from a particular country during a specific period of time. You learn how to create page variants and how to choose an audience. You also test the campaign with the Preview app. Magnolia EE Pro 5.3+
Before you start:
Mother's Day is celebrated on different days and ways around the world. In the United Kingdom mothers celebrate with cake on the fourth Sunday in Lent. In China mums receive carnations (flower) on the second Sunday in May. Create a personalized campaign that targets Mother's Day shoppers in U.K. and China.
Create two variants of the demo-project home page. Define U.K. and China as target countries using the Country trait. Use the Date trait to run the campaign during the week leading to Mother's Day. On each page variant, add a teaser that appeals to the target audience. Use text and images that advertises the typical gift in each country. Finally, test the campaign to ensure that correct variant is served to visitors.
|Run dates||March 8 to 15, 2015||May 3 to 10, 2015|
|Teaser title||Mother's Day||母亲节|
|Teaser text||A full range of Mother's Day cakes are ready for delivery on Sunday 15th of March. Order now!||许多美丽的康乃馨将于周日5月10日交付。立即订购！|
cupcake.jpg photo by Louise McLaren
carnation.jpg photo by Family O'Abé
A variant is an alternative content element that replaces the original element in personalized content delivery. Magnolia serves the variant instead of the original element when personalization rules match. A variant is a copy of the original element, edited to best suit the intended audience.
Create two variants of the demo-project home page:
Magnolia creates two variants. The system also marks the original page with the variant icon. This icon tells editors that the page has alternative content.
Choose an audience for the U.K. variant:
Mother's Day shoppers in U.K.
United Kingdom. This rule serves the variant to visitors from the U.K.
Choose an audience for the China variant:
Mother's Day shoppers in China
Country-segments - China.
Personalize the content on each page variant. Edit the first item in the teaser carousel. Replace the title, text and image with appropriate Mother's Day content.
Personalize the U.K. page variant. Add an English language teaser element and a picture of a cake.
Personalize the Chinese page variant. Add a Simplified Chinese teaser element and a picture of a cake.
Test the campaign in the Preview app. Impersonate U.K. and Chinese visitors and verify that the correct content variant is served.
Publish all modified content and configuration to the public instance:
Test variant delivery on the published website. You can pass traits as parameters in the URL. This is a handy way to test scenarios that would otherwise be difficult to reproduce such as requesting the page from a Chinese IP address.
Use the following format:
previewParameterPrefix: Identifies the parameter as a preview parameter. Parameters used for personalization have a special prefix that sets them apart from other parameters. The default prefix is
preview, for example
previewCountry. The prefix string is configurable in Configuration >
Parameter: Name of the parameter with first letter capitalized, for example
value: Parameter value in a valid format. The format depends on the parameter. For the country trait the value is a two-letter country code (
cn) and for a date it is a timestamp written as
Example: visitor from the U.K. on March 15, 2015:
Example: visitor from China on May 10, 2015: