Understand and extend the web event schema
Every action the Salesforce Interactions SDK reports — a page view, a click, or a custom action you define — travels to Personalization as one event object built around an interaction: a small record naming what the visitor did. Most page views are captured automatically; everything else you send yourself with one function call.
Send and extend events
- Let the Sitemap capture page views automatically — no code needed on pages it already matches.
- Track a click or other custom action by calling
SalesforceInteractions.sendEvent()with aninteractionobject that has aname. - Attach product, cart, or order data to an interaction using the built-in
CatalogObjectInteraction,CartInteraction, orOrderInteractionshapes instead of inventing your own fields. - Include a known identity (such as an email address) on the event’s
user.identitiesfield when you want it tied to a specific visitor. - Listen for
OnBeforeEventSendduring testing to inspect, or cancel, an event before it leaves the browser.
// Track a custom interaction when a visitor clicks a banner
SalesforceInteractions.listener("click", ".header-banner", () => {
SalesforceInteractions.sendEvent({
interaction: { name: "Banner Click" },
user: { identities: { emailAddress: userEmail } },
});
});
Discussion
Comments are not configured for local development. They appear once the site owner connects GitHub Discussions (Giscus).