Blog

Extending Sitecore Experience Profile in Sitecore 9

20th September 2018

Sitecore

Sitecore Commerce

In this post we will look at how to display the custom contact facets in the Sitecore Experience Profile. We looked at the posts by Jonathan Robbins AKA ISlayTitans (Obviously he likes slaying Titans) and we needed to customize it for Sitecore 9.

First, we added two new Interaction facets as shown below:

usingSystem;

usingSitecore.XConnect;

namespaceKonabos.XConnect.Loyalty.Model.Facets

{

[FacetKey(DefaultFacetKey)]

[Serializable]

publicclassLoyaltyOrderInfoFacet:Facet//Interaction Facet: Information about the order placed during the interaction

{

publicconststringDefaultFacetKey="LoyaltyOrderInfoFacet";

publicstringOrderId{get;set;}

publicdoubleOrderTotal{get;set;}

publicintPointsEarned{get;set;}

publicintPointsSpent{get;set;}

}

}

usingSystem;

usingSitecore.XConnect;

namespaceKonabos.XConnect.Loyalty.Model.Facets

{

[FacetKey(DefaultFacetKey)]

[Serializable]

publicclassLoyaltyInteractionFacet:Facet//Interaction Facet: Interactions such as registered, bought 2x of a product, performed an action

Once those are setup, you need to get the JavaScript file ready. Here is an example of the file we used and make sure the name used matches the processor grouping we had in the configs. Configure it accordingly using Sitecore Rocks on the Panel item.