1. Events on interactions

Custom event with custom data that maps without transformation

Version:

If the custom event you are mapping to in Sitecore 9 has any additional properties to consider, it may be possible to map those properties directly from the page event in Sitecore 8.x.

Consider an example where, in Sitecore 8.x, you captured a page event when the visitor views a page that displays the status of his membership in a customer loyalty program.

In MongoDB, the page event looks like the following:

{
    "Name" : "Loyalty program status checked",
    "ItemId" : NUUID("4257b6b4-e263-4356-bba1-9affce442a77"),
    "Timestamp" : NumberLong(0),
    "Data" : "silver",
    "Text" : "Loyalty program status level for member 100011 is silver",
    "PageEventDefinitionId" : NUUID("5963f929-f278-4784-ba9d-be2fa5b86ae9"),
    "DateTime" : ISODate("2017-11-11T11:`00:00`.000Z"),
    "Value" : 5
}

In Sitecore 9, you created the following custom event to represent this data:

using Sitecore.XConnect;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MigrationTool.Examples.Loyalty
{
    public class LoyaltyProgramStatusCheckedEvent2 : Event
    {
        public LoyaltyProgramStatusCheckedEvent2(Guid definitionId, DateTime timestamp) : base(definitionId, timestamp)
        {
        }

        public string StatusLevel { get; set; }
    }
}

You want to implement the following mapping:

Sitecore 8.x propertySitecore 9 property
DataStatusLevel
DateTimeTimestamp
PageEventDefinitionIdDefinitionId
TextText
ValueEngagementValue
If you have suggestions for improving this article, let us know!