Sitecore CDP and Personalize are often marketed as separate products, but they are, in fact, integrated components of a unified platform designed to streamline and modernize personalization across an organization’s omnichannel- online, and offline assets. However, their potential can be extended beyond this primary function. By fully understanding the capabilities of both CDP and Personalize and how they can work together, we can unlock innovative “Art of Possible” projects, even for purposes we may not have originally considered. In this blog, we’ll explore two design patterns that can be applied to achieve this.
Development Pattern 1: Storing or Updating Data in Sitecore CDP Using Sitecore Personalize
Objective: Utilize Sitecore Personalize’s Triggered Experience to seamlessly perform CDP CRUD operations directly within the platform, eliminating the need for external code. However, the option to call the Guest REST API/Batch API directly remains available if needed.
Use Case: Handling Acceptance of Terms and Conditions
This process captures the user’s acceptance of terms and conditions and records the acceptance data. To enhance the user experience, the terms screen is displayed only once across all the user’s touchpoints. Leveraging Sitecore CDP’s persistence capabilities allows us to achieve this, overcoming the limitations of Sitecore Personalize’s 100 events, 90-day duration, and 40-session limit.
1. Execute Personalize Experience and Capture Custom Event
const eventData = {
"channel": "WEB",
"type": "view:Policy",
"language": "EN",
"currency": "USD",
"page": "home",
"pos": "defult",
}
window.engage.event("view:Policy", eventData);
2. Create a ‘Connection’ Using the Guest API:
- Use the Guest API endpoint:
https://api-engage-us.sitecorecloud.io/v2.1/guests/${uid}/extensions/ext2
. - Parameterize the Guest GUID and the request body to establish a connection specific to each user.
3. Compose an Interactive Experience:
- Reference the connection you created in Step #2.
- Set values that we plan to set in CDP, in this example I use date field that will be set in the EXT sections of CDP
Connection:
https://api-engage-us.sitecorecloud.io/v2.1/guests/${uid}/extensions/ext2
The payload is set in the “API body” of the Webhook Composer. In this example, the payload is transactional, but a Decision Model can be used to load data from Personalize into CDP.
<#assign today = .now>
<#assign nowTime = today?long?replace(",","")?number>
<#assign nowDate = today?string('yyyy-MM-dd HH:mm:ss')>
{
"PolicyAcceptance": "${nowDate}"
}
4. Develop a Decision Model(optional):
- If content enrichment is required, create a decision model that dynamically captures custom events data and set’s it into CDP
5. Configure the Trigger
- Perhaps the most crucial step, serving as the glue between CDP and Personalize, is capturing the event in Personalize and using it to trigger an update in CDP once the event is created.
6. Consider Security Measures:
- Ensure compliance with data privacy regulations and Sitecore security guidelines.
- Since the Sitecore Personalize key is inherently public, it’s important to implement additional security measures to protect your content.
Development Pattern 2: Using Personalize Custom Event Schema as Transactional Storage
Objective: Utilize Sitecore Personalize events, combined with custom schema support, to store transactional data and retrieve it using the Interactive Experience. This approach is effective provided the limitations of 90 days, 40 sessions, and 100 events per session are acceptable. To maximize event utilization, control session duration by creating POS with session expirations of 12-24 hours, based on event data frequency. This strategy enables a session per day, optimizing event usage.
Use Case: Managing the Notification or Alerts
This involves capturing and storing notification data in Sitecore Personalize and using the Interactive Experience to display personalized notifications tailored to each individual user within the web experience.
1. Create new Personalize storage container (Guest->Sessions->Events) and assign browser_id.
A: GET Request to create Browser ID: https://api-engage-us.sitecorecloud.io/v1.2/browser/create.json?client_key={{key}}
B: GET Request: Call Identity Event to map Browser ID to the storage container (EMAIL):
https://api-engage-us.sitecorecloud.io/v1.2/event/create.json?client_key={{key}}&message={
"channel":"WEB",
"type":"IDENTITY",
"language":"EN",
currency":"USD",
"pos":"default",
"browser_id":"35504642-112a-47ea-96fd-",
"email":"PROD1@PROD.com",
"identifiers":[{"provider":"email","id":"prod1@prod.com"}]
}
2. Capture Events into Personalize. Define JSON schema and design simple Get Request
https://api-engage-us.sitecorecloud.io/v1.2/event/create.json?client_key={{key}}&message=
{
"channel":"OFFLINE",
"type":"alert:{{Type}}",
"language":"EN",
"currency":"USD",
"page":"alert",
"pos":"Core Alerts",
"browser_id":"35504642-112a-47ea-96fd-",
"ext":{
"Product":"{{Product}}",
"AlertID":"{{AlertId}}",
"Title":"{{Title}}","Description":"Lorem ipsum dolor",
"URL":"https://google.com",
"EndDate":"{{currentdate}}",
"StartDate":"{{currentdate}}"
}
3. Develop Interactive Experience to read data stored in Personalize
Example Code (Not for Production; additional checks required):
API:
{
"alerts": ${decisionModelResults.decisionModelResultNodes[0].outputs[0].programmable1}
}
(function () {
var k =0;
var listTitles =[];
var cdpSessions = guest.sessions;
k = 0;
for (var i = 0; i < cdpSessions.length ; i++) {
var cdpSession = cdpSessions[i];
if (cdpSession.sessionType === 'WEB') {
var events = cdpSession.events;
for (var j = 0 ; j < events.length; j++) {
var event = events[j];
if(event){
if(event.arbitraryData!== null && event.channel === "OFFLINE"){
if(event.type.startsWith('alert:') === true){
let arrAlert ={
Title: event.arbitraryData.ext.Title,
StartDate:event.arbitraryData.ext.StartDate,
EndDate:event.arbitraryData.ext.EndDate
}
listTitles.push(arrAlert);
k++;
}}}}}}
return JSON.stringify(listTitles);
})();
Call Interactive Experience:
POST: https://api-engage-us.sitecorecloud.io/v2/callFlows
Body:
{ "clientKey": "{{key}}",
"channel": "WEB",
"language": "en",
"currencyCode": "USD",
"pointOfSale": "default",
"browserId": "35504642-112a-47ea-96fd-",
"friendlyId":"ie_test_XXXXX"
}
4. Develop a Web Experience in Sitecore Personalize to display the data. An additional feature could include the ability to hide viewed alerts.
Whether you’re capturing user consent, managing notifications, or storing transactional data, Sitecore CDP/P platform provides a flexible framework that can be customized to meet diverse needs. Embracing these capabilities not only enhances the personalization of user experiences but also leverages Sitecore’s robust data management features to drive more meaningful interactions.
As you consider these advanced use cases, remember to consider security measures and compliance with data privacy regulations to protect user information and ensure a secure implementation. By harnessing the full potential of Sitecore CDP and Personalize, you can transform how you manage and utilize customer data, paving the way for more dynamic and engaging digital experiences.
Recent Comments