Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 3 Current »

CDP4S uses Sitecore CDP Full Stack Experiences to send and retrieve Guest data.

Audience Template

Create a new Real-Time Audience Template under Library > Audience Templates. This allows restricting data sent to Salesforce to avoid unnecessarily exceeding API limits. Create a JavaScript function as follows to limit to identified (Customer type) Guests only:

// Include only identified (Customer type) Guests.
(function () {
  return (guest.guestType == 'customer');
})();

Add further restrictions if you have specific requirements. This is particularly important if your site experiences high traffic and/or you are running into Salesforce limits.

Triggered Experience

Create a Full Stack Triggered Experience to automatically send Guest data to Salesforce. For the trigger we recommend:

  • Session Closed to send when a Guest session ends, or

  • Custom Trigger on the IDENTITY event to send as soon as the Guest is identified, or

  • both of the above

Limit the Audience using the Audience Template created above.

Create a Webhook variant that sends to the Destination Connection created above. Create the API response with the following Freemarker template for the public API endpoint:

<#-- Output the first browser ref we find.
Salesforce will use this to do a reverse lookup for the Guest. -->
{
<#list guest.sessions as session>
    <#if session.browserRef?has_content>
      "browserRef": "${session.browserRef}"
      <#break>
    </#if>
</#list>
}

Or this for the OAuth2 endpoint:

<#-- Output all Guest data. -->
${toJSON(guest)}

Under the Details tab, change the Channel of the Experience to Push Notification. This will help distinguish events from normal user interactions.

Interactive Experience

Create a Full Stack Interactive Experience with the same Audience Template and API response as per the OAuth2 option above. Note the friendlyId value for configuration in Salesforce - this Experience will be used to retrieve Guest data on demand.

  • No labels