Sitecore CDP Activation – A Developer’s Guide

*Updated on 9/26/23

Editor's Note: This is the second article in our series offering a concise guide to Sitecore CDP for developers. See the first article here: "Sitecore CDP Explained."

What is Sitecore CDP?

Sitecore CPD is a solution for siloed data; it connects and activates customer data across various software to drive purpose and relevance and deliver a more personalized experience. Sitecore CDP helps build rich customer profiles, stemming from a number of sources, both online and offline, while simultaneously creating a single source of truth. 

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.

The Role of JavaScript in CDP Activation

When a user visits the website, the CDP JavaScript library creates a cookie and assigns it a browser ID. From then on, every event and action the user is making will be registered under this specific browser ID.

To initiate this, developers first need to include the JavaScript library within the backend of your website by copying and pasting the following code. Then, they can close the tag in the website template page.

Code for CDP Activation

Sitecore CDP and Personalize

Sitecore Personalize empowers businesses to capture, merge, and activate omnichannel customer data originating from the CDP. This wealth of customer data serves as the driving force behind the experimentation, decision-making processes, and overall user experience within Personalize, equipping you with the insights needed to make well-informed choices regarding your content and marketing strategies.

These two tools seamlessly collaborate to cultivate profound customer connections through tailored experiences. The accompanying diagram illustrates the synergy between CDP and Personalize. On the left-hand side of the visual representation, data from diverse sources is aggregated, encompassing online and offline channels, facilitated by various APIs.

Drawing from this diverse data pool, CDP aids us in comprehending each user's behaviors, encompassing their preferences, searches, purchases, and customer attributes such as device type, geographic location, and age. Subsequently, Personalize steps in to optimize customer interactions.

Registering Guest Events: From Page Views to Checkouts

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.

Sending raw event data is easy using the following JavaScript example for a page view event:

Code for pushing events into the queue

Here’s another example of sending raw event data – this time for adding a product to a shopping cart: 

code for sending raw event data

You can send tracking data to Sitecore CDP by adding the following line before the “eventCreate” function:

code to add before the eventCreate function

Enhance Your Backend with Custom Data Integration

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.

Standard vs Custom Events: What You Need to Know

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:

custom events chart

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: Data Collection and Management

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:

guest data code

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 following Sitecore CDP documentation: 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:

custom guest data code


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.

Sitecore CDP Dashboard: Insights for Marketers

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. 

Navigating the Sitecore CDP Dashboard: A Marketer's Perspective

guests data dashboard


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. 

dashboard with live data


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.”

interaction timeline



guest information


Interpreting Aggregated Information for Marketing Strategies

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, check the Sitecore CDP documentation. Or better yet, let help you. Our Sitecore experts and range of Sitecore development services can guide you through the process – no matter which solution you’re looking to implement. 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, creates user-focused, digital experiences by integrating strategy, UX, and design that delivers transformative results. Contact us today to learn how 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. 

About Author

Naim Al
Naim holds a Bachelor Degree in Information Technology and an MBA in Finance. He started his career in programming in 2001 building desktop financial applications. In 2004 he shifted his focus to develop websites. In 2016 Naim joined as a Senior Sitecore Developer. In 2020 Naim won the 1st place in Sitecore Hackathon 2020 competition with American Eagle XTeam Winner, over 82 teams from more than 23 countries were participating. When he is not coding, he likes to spend time with his wife and two kids, watching TV, or relax in his backyard.

Featured Posts