Extension data object
Use the extension data object to collect custom data about an event that you then send to Sitecore CDP. This is an optional object that you can specify as the last function argument when you send events. This object accepts a maximum of 50 custom attributes of your choice.
After you send the event, the data in this object becomes available in the event, but not in the guest profile.
When you build this object, use a flat object structure. Sitecore CDP automatically flattens nested objects and renames the keys as necessary. For example:
Here's an example of how to use the event()
function to send a custom event called myretailsite:CLICKED_POPUP
. eventData
contains all the required attributes for the event data object. extensionData
contains the custom data.
import { engage } from "./engage.js";
// ...
const handleClick = async (e) => {
e.preventDefault();
const eventData = {
channel: "WEB",
currency: "EUR",
pointOfSale: "myretailsite/ireland",
language: "EN",
page: "home"
};
const extensionData = {
customKey: "customValue"
};
await engage.event("myretailsite:CLICKED_POPUP", eventData, extensionData);
};