Editor’s note: This blog post is the second in a series focused on a developer’s quick guide to Sitecore CDP.
Now that you’ve learned what Sitecore’s CDP is all about, it’s time to activate it in your website’s backend. This post will take you through how to activate the CDP itself as well as how to add custom data to your backend. You’ll also gain a sneak peek into what Sitecore CDP looks like once it’s correctly implemented.
Pushing Events into the Queue
After the CDP is activated, guest events will need to be registered. It happens by sending the “events” into the event queue. Common guest events include page views, searches, payments, checkouts, etc.
Here’s another example of sending raw event data – this time for adding a product to a shopping cart:
You can send tracking data to Sitecore CDP by adding the following line before the “eventCreate” function:
Adding Custom Data to the Data Model
The data is being saved in Sitecore CDP Data Model, a flexible and extensible solution that enables developers to add custom data as extensions to fix business differences as key value pair.
Sending Custom Events
Sitecore CDP has a good list of standard events, however, sometimes the business need may require you to use a custom event. Custom events are sent the same way as a standard event. In order you send a custom event, though, you will need to follow the same naming standards. For example, having the name of the event in all uppercase letters.
CDP reserved event list name:
Note: If you need to end the session before the timeout, to push and process the CDP data, you have to send the event as FORCE_CLOSE. This will come in handy during the development phase, but not during production.
Identifying Guests and Sending Guest Data
Once a user is logged in, and the “Identity” event has been triggered, the CDP will scan for any existing profiles that match the exact identity. If the identity is not found, it will create a brand-new profile.
It’s worth noting that sending an “Identity” event will not push the guest’s information (first name, last name, email address). So, to create the guest profile with the required data in the CDP, you need to call the POST API: /v2/guests and pass the guest data model as JSON.
The following guest data model is an example of how to create a guest using those identifiers:
It’s also important to note that “create guest” does not check if the guest exists before its created. So, to avoid duplication, use the locate guests first function in Sitecore CDP REST API.
Sitecore CDP has a long list of available guest model attributes. Check the list on the Sitecore CDP guest data model for REST API.
If the aforementioned list does not contain enough for your business needs, you can add custom guest data using the following data extension:
Consult the following guidelines when using the guest data extension:
- A guest type can only have one data extension.
- The name of the guest data extension must be ext.
- The key of the guest data extension must be default.
- The attribute name of the guest data extension must be alphanumeric [A-Z,a-z,0-9] as per the json rfc7159 specification.
- The attribute name of the guest data extension must be written in camelCase.
- The attribute name of the guest data extension must be unique within the entire guest type.
- Make the attribute name meaningful.
- If grouping is required, use common prefixes.
- A guest data extension has a maximum of 100 attributes.
Parts one and two of this series have led us through the set up of the Sitecore CDP. We’ve pushed various events including “Page Views” and “Identity” and we’ve updated customer profile data. Now, let’s go through how to view the aggregated information and the value it can offer to marketers.
In the Sitecore CDP dashboard, marketers can access “Guests” from the panel located under the Customer Data panel. They can then view live data for all guests including those that are anonymous (the ones that haven’t been identified yet). Clicking on a visitor will open that specific visitor’s profile page which then displays detailed information about each visit, the channel used to visit the site, first and last time visited, total amount spent, and much more.
Marketers can also check the interaction timeline for each visitor. They can filter by “Interactions Type” and “Date” as well as by “Order Details” and “Guest Information.”
This article provided a brief summary on Sitecore CDP. It’s meant to be used as a quick guide to help developers jump start their CDP integration. If you’re not sure where to begin on your integration, let Americaneagle.com help you. Our dedicated team of Sitecore experts can guide you through the process – no matter which solution you’re looking to implement.
Americaneagle.com is a Sitecore Platinum Implementation and Hosting Partner with platform expertise spanning over 10 years. For mid to large enterprise clients looking for a flexible, powerful content management solution, Americaneagle.com creates user-focused, digital experiences by integrating strategy, UX, and design that delivers transformative results. Contact us today to learn how Americaneagle.com is the perfect Sitecore partner.
Stayed tuned for another two-part series focused on the features of the Sitecore CDP such as experiences and experiments. The series will close out with a practical personalization example using Sitecore CDP.