Sitecore CDP is a great platform that allows you to register Customer Data for analysis and build Decision Models to create Customer Experiences.
As a developer our first steps are to capture data, it could be some integrations like visiting a page. In this article I will show you how to send events to Sitecore CDP.
Step 1. Create your Point of Sale
Click on System Settings > Point of Sale then click on Create
Fill the form:
- Name your Point Of Sale: Your Point of Sale Name.
- Market: Information about the market.
- Brand: You can fill with your brand.
- Language: Target language
- Timeout (in minutes) : Once an user is inactive to close the browser there is a timeout setting that is useful to understand when the user abandon the session.
Step 2: Setup Javascript Library in your Website
var _boxeverq = _boxeverq || [];
// Define the Boxever settings
var _boxever_settings = {
client_key: '[YOUR_CLIENT_KEY]',
target: 'https://api.boxever.com/v[YOUR_API_VERSION]',
cookie_domain: '[YOUR_WEBSITE_DOMAIN]',
web_flow_target: "https://[YOUR_WEBFLOW_TARGET].cloudfront.net",
pointOfSale: "[YOUR_POINT_OF_SALE]"
};
(function() {
var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true;
s.src = '[CDN]/boxever-1.4.1.min.js';
var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
})();
Add this script into your website and this will inject Sitecore CDP JavaScript Library.
Step 3: Add Event in your website page.
// Place an anonymous function in the Boxever queue
_boxeverq.push(function() {
var viewEvent = {
browser_id: Boxever.getID(),
channel: "WEB",
type: "VIEW",
language: "EN",
currency: "USD",
page: "/", // Your page path
pos: "[YOUR_POINT_OF_SALE]"
};
//Add UTM params
viewEvent = Boxever.addUTMParams(viewEvent);
// Invoke event create
// (<event msg>, <callback function>, <format>)
Boxever.eventCreate(viewEvent, function(data) {}, "json");
});
Step 4: Visit your website
Finally if you visit your website and then go to Sitecore CDP Platform you will see a new event registered for your target user.
Here you can find more information about how to customize an event:
I hope this article will be helpful to start your Sitecore CDP implementations.
Leave a Reply