Page tree
Skip to end of metadata
Go to start of metadata

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:

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:

  1. Create a Festivals page.
  2. Create two personalized variants of the page. In each variant, add content that appeals to the target audience. 
  3. Define U.K. and China as target countries using the Country trait.
  4. Run the campaign for two weeks prior to the festival date using the Date trait.
  5. Test the campaign to ensure that correct variant is served to visitors.
Target country(none)ChinaUnited Kingdom
Run dates(none, ongoing)May 26 to June 9, 2016July 27 to August 10, 2016
Component title FestivalsDragon Boat FestivalPuck 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

Create original page

Create a new page in the Travel demo site:

  1. Open the Pages app.
  2. Select /travel and click Add page.
  3. Name the page festivals and select the Travel Standard template.
  4. 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.
    • Imagefestivals.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:.

  1. Select /travel/festivals
  2. 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:

  1. Select the first variant and click Choose audience.
  2. Set Name to Chinese Dragon Boat Festival Travelers.
  3. 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.

Choose an audience for the U.K. variant:

  1. Select the second variant and click Choose audience.
  2. Set Name to U.K. Puck Fair Travelers.
  3. Define the personalization rules:
    1. Set Country to United Kingdon.
    2. Set Start date to 2016-07-27 and End date to 2016-08-10.

Personalize content

Personalize the page variants:

  1. Edit the Chinese page variant.
  2. Edit the Text and image component in main area and replace content with:
    • Title: 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.
    • Imagedragonboat.jpg

  1. skip
  2. skip
  3. Edit the U.K. page variant.
  4. Edit the Text and image component in main area and replace content with:
    • Title: 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.
    • Imagekingpuck.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.

  1. Open the Preview app.
  2. Go to the festivals page.
    • Expected result: The original page is served, not a personalized variant.
  3. Select a Chinese persona 王芳 Wang Fang.
    • Expected result: The original page is still served because you have not defined a date.
  4. Set Date to 2016-06-09 or any other day during the Chinese variant run dates.
    • Expected result: The Chinese variant is served.
  5. 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). 

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>
previewParameterPrefixIdentifies 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 (ukcn) 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&amp;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=uk&amp;previewDate=2016-07-27-00-00-00


Credits: