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.
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.
Prerequisites
Before you start:
- Read Personalization to understand the terms.
- Install the Personalization module.
Use case: Festival tours
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:
- Create a Festivals page.
- Create two personalized variants of the page. In each variant, add content that appeals to the target audience.
- Define U.K. and China as target countries using the Country trait.
- Run the campaign for two weeks prior to the festival date using the Date trait.
- Test the campaign to ensure that correct variant is served to visitors.
Target country | (none) | China | United Kingdom |
---|---|---|---|
Run dates | (none, ongoing) | May 26 to June 9, 2016 | July 27 to August 10, 2016 |
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 original page
Create a new page in the Travel demo site:
- Open the Pages app.
- Select
/travel
and click Add page. - Name the page
festivals
and select the Travel Standard template. - Edit the page and add a Text and image component in main area:
- Headline: Festivals
- Text: Experience diverse cultures at their most festive. Join in the fun of festivals around the world with our exclusive festival tour packages.
- Image: festivals.jpg
Create page variants
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:.
- Select
/travel/festivals
- Click Add page variant two times.
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 audience
Choose an audience for the Chinese variant:
- Select the first variant and click Choose audience.
- Set Name to
Chinese Dragon Boat Festival Travelers
. - Click Pick Trait to define traits:
- Set Country to
China
. This rule serves the variant to visitors from China. - Set Date to a range from 2016-05-26 to 2016-06-09. This rule serves the variant for two weeks leading up to the festival.
- Set Country to
Choose an audience for the U.K. variant:
- Select the second variant and click Choose audience.
- Set Name to
U.K. Puck Fair Travelers
. - Define the personalization rules:
- Set Country to
United Kingdon
. - Set Start date to 2016-07-27 and End date to 2016-08-10.
- Set Country to
Personalize content
Personalize the page variants:
- Edit the Chinese page variant.
- Edit the Text and image component in main area and replace content with:
- Headline: Dragon Boat Festival
- Text: 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.
- Image: dragonboat.jpg
- Edit the U.K. page variant.
- Edit the Text and image component in main area and replace content with:
- Headline: Puck Fair
- Text: 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.
- Image: kingpuck.jpg
Preview the variants
Test the campaign in the Preview app. Impersonate Chinese and U.K. visitors and verify that the correct content variant is served.
- Open the Preview app.
- Go to the festivals page.
- Expected result: The original page is served, not a personalized variant.
- Expected result: The original page is served, not a personalized variant.
- Select a Chinese persona 王芳 Wang Fang.
- Expected result: The original page is still served because you have not defined a date.
- Expected result: The original page is still served because you have not defined a date.
- Set Date to 2016-06-09 or any other day during the Chinese variant run dates.
- Expected result: The Chinese variant is served.
- Expected result: The Chinese variant is served.
- Set Country to United Kingdom and Date to 2016-08-10 or any other day during the U.K. variant run dates.
- Expected result: The U.K. variant is served. This is an example where the country trait you explicitly chose (U.K) overrides the country of the persona (China).
- Expected result: The U.K. variant is served. This is an example where the country trait you explicitly chose (U.K) overrides the country of the persona (China).
Publish content and configuration
Publish all modified content and configuration to the public instance:
- Festivals page in Pages >
/travels/festivals
. - U.K. and China variants in Pages >
/travels/festivals/variants
. - Images in the Assets app.
Test variant delivery on 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:
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 2016-05-26-00-00-00 ). |
Example: Visitor from China on May 26, 2016:
http://localhost:8080/magnoliaPublic/travel/festivals.html?previewCountry=cn&previewDate=2016-05-26-00-00-00
Example: Visitor from the U.K. on July 27, 2016:
http://localhost:8080/magnoliaPublic/travel/festivals.html?previewCountry=gb&previewDate=2016-07-27-00-00-00
Credits:
- Stewart White: Festivals photo. Creative Commons Attribution 2.0 Generic (CC BY 2.0)
- Iidxplus: Dragon boat photo. Creative Commons Attribution-Share Alike 3.0 Unported .
- Buck Lewis: King Puck photo. Creative Commons Attribution 2.0 Generic (CC BY 2.0)