My first personalized campaign
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 info | Component info |
---|---|
none |
Festivals
Credit: photo by Stewart White |
China; 26 May > 9 June |
Dragon Boat Festival
Credit: photo by Iidxplus |
UK/IE; 27 July > 10 August |
Puck Fair
Credit: 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
-
Variant
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 2019-05-26 to 2019-06-09. This rule serves the variant for two weeks leading up to the festival.
-
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 Kingdom
. -
Set Start date to 2019-07-27 and End date to 2019-08-10.
-
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.
-
-
Select a Chinese persona 王芳 Wang Fang.
-
Expected result: The original page is still served because you have not defined a date.
-
-
Set Date to 2019-06-09 or any other day during the Chinese variant run dates.
-
Expected result: The Chinese variant is served.
-
-
Set Country to United Kingdom and Date to 2019-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).
-
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>
|
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
|
|
Name of the parameter with first letter capitalized, for
example |
|
Parameter value in a valid format. The format depends on the
parameter. For the country trait the value is a two-letter country code
( |
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
-
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)