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. (warning) Magnolia EE Pro 5.3+

Prerequisites

Before you start:

Use case: Mother's Day shopping campaign

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.

CountryUnited KingdomChina
Run datesMarch 8 to 15, 2015May 3 to 10, 2015
Teaser titleMother's Day母亲节
Teaser textA full range of Mother's Day cakes are ready for delivery on Sunday 15th of March. Order now!许多美丽的康乃馨将于周日5月10日交付。立即订购!
Teaser image

cupcake.jpg photo by Louise McLaren

carnation.jpg photo by Family O'Abé

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 demo-project home page:

  1. Open the Pages app.
  2. Select the /demo-project home page.
  3. 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 U.K. variant:

  1. Select the first variant and click Choose audience.
  2. Set Name to Mother's Day shoppers in U.K.
  3. Define traits:
    • Set Country to United Kingdom. This rule serves the variant to visitors from the U.K.
    • Set Date to a range from 2015-03-08 to 2015-03-15. This rule serves the variant during the week before Mother's Day.

Choose an audience for the China variant:

  1. Select the second variant and click Choose audience.
  2. Set Name to Mother's Day shoppers in China
  3. Define the personalization rules:
    1. Set Segment to Country-segments - China.
    2. Set Start date to 2015-05-03 and End date to 2015-05-10.

Personalize content

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.

  1. Edit the U.K. page variant.
  2. Overwrite the first teaser item:
    • Title: Mother's Day
    • Text: A full range of Mother's Day cakes are ready for delivery on Sunday 15th of March. Order now!
    • Imagecupcake.jpg

Personalize the Chinese page variant. Add a Simplified Chinese teaser element and a picture of a cake.  

  1. Edit the Chinese page variant.
  2. Overwrite the first teaser item:
    • Title: 母亲节
    • Text: 许多美丽的康乃馨将于周日5月10日交付。立即订购!
    • Imagecarnation.jpg

Preview the variants

Test the campaign in the Preview app. Impersonate U.K. and Chinese visitors and verify that the correct content variant is served.

  1. Open the Preview app.
  2. Go to the demo-project home page.
    • Expected result: The default home page is served, not a personalized variant.
  3. Select a Chinese persona 王芳 Wang Fang.
    • Expected result: The default home page is still served because you have not defined a date.
  4. Set Date to 2015-05-10 or any other day during the previous week.
    • Expected result: The Chinese variant is served.
  5. Set Country to United Kingdom and Date to 2015-03-15 or any other day during the previous week.
    • 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:

  • Demo-project home page in Pages > /demo-project
  • U.K. and China variants in Pages > /demo-project/variants
  • Cupcake and carnation 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>

Where:

  • 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 Configuration > /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 (uk, cn) and for a date it is a timestamp written as yyyy-mm-dd-hh-mm-ss such as  2015-05-10-00-00-00).

Example: visitor from the U.K. on March 15, 2015:

http://localhost:8080/magnoliaPublic/demo-project.html?previewCountry=uk&amp;previewDate=2015-03-15-00-00-00

Example: visitor from China on May 10, 2015:

http://localhost:8080/magnoliaPublic/demo-project.html?previewCountry=cn&amp;previewDate=2015-05-10-00-00-00

 


Credits:

#trackbackRdf ($trackbackUtils.getContentIdentifier($page) $page.title $trackbackUtils.getPingUrl($page))