Magnolia 6.0 reached end of life on June 26, 2019. This branch is no longer supported, see End-of-life policy.
In this tutorial you learn to personalize content. Your goal is to serve content to visitors from a particular country at a specific time. You will learn to create content variants and to choose an audience. We also test the campaign in the Preview app.
Before you start:
Various festivals are held in different countries on different dates throughout the year. Create a personalized campaign that promotes the Puck Fair festival to U.K. visitors and the Dragon Boat Festival to Chinese visitors.
Your tasks:
Target country | (any) | China | United Kingdom |
---|---|---|---|
Run dates | (any, ongoing) | May 26 to June 9, 2019 | July 27 to August 10, 2019 |
Component title | Festivals | Dragon Boat Festival | Puck Fair |
Component text | Experience diverse cultures at their most festive. Join in the fun of festivals around the world with our exclusive festival tour packages. | The Dragon Boat Festival is also known as the Duanwu Festival. It is a traditional holiday that commemorates the life and death of the famous Chinese scholar Qu Yuan. The festival occurs on the fifth day of the fifth month on the Chinese lunar calendar. | On August 10, a three-day festival known as Puck Fair is held in Killorglin, Ireland. Residents of the town capture a goat and proclaim it to be the King for three days of revelry. |
Component image | festivals.jpg photo by Stewart White | dragonboat.jpg photo by Iidxplus | kingpuck.jpg photo by Buck Lewis |
Create a new page in the Travel demo site:
/travel
and click Add page.festivals
and select the Travel Standard template.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 Festivals page:.
/travel/festivals
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 Chinese variant:
Chinese Dragon Boat Festival Travelers
.China
. This rule serves the variant to visitors from China.Choose an audience for the U.K. variant:
U.K. Puck Fair Travelers
.United Kingdon
.Personalize the page variants:
Test the campaign in the Preview app. Impersonate Chinese and U.K. visitors and verify that the correct content variant is served.
Publish all modified content and configuration to the public instance:
/travels/festivals
./travels/festivals/variants
.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:
http://example.com?<previewParameterPrefix><Parameter>=<value>
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 previewPersona or previewCountry . The prefix string is configurable in /modules/personalization-preview-app/config/previewParameterPrefix . |
<Parameter> | Name of the parameter with first letter capitalized, for example Country or Date . |
<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 (gb , cn ) and for a date it is a timestamp written as yyyy-mm-dd-hh-mm-ss such as 2019-05-26-00-00-00 ). |
Example: Visitor from China on May 26, 2019:
http://localhost:8080/magnoliaPublic/travel/festivals.html?previewCountry=cn&previewDate=2019-05-26-00-00-00
Example: Visitor from the U.K. on July 27, 2019:
http://localhost:8080/magnoliaPublic/travel/festivals.html?previewCountry=gb&previewDate=2019-07-27-00-00-00
Credits: