The Sitecore CDP Blueprints library created by the Sitecore team contains useful configurations and snippets. You can either use as a reference to help understand key concepts or adapt and use in your own implementations. Which can help you get up and running quicker with Sitecore CDP.
Web Experience Snippets
These snippets can be used to create web templates for your marketing team in their Web Experiences. Simply copy and paste the provided HTML, CSS, and JavaScript into the corresponding tabs when creating a new template.
The library contains the following examples:
- Alert Bar – An alert bar that can be triggered top or bottom of your website (see knowledge hub).
- Corner Pop-up – A card with image and call to action that will pop up in the bottom right corner of your website.
- Email Capture Bar – A bar that appears at the top or bottom of your site to allow for email capture (see knowledge hub).
- Email Capture Corner Pop-up – A corner pop-up that appears at the left or right bottom corner of your site to allow for email capture (see knowledge hub).
- Inactive Tab – Entices the user to return to your website with a message by flashing the browser tab (see knowledge hub).
- Notification Widget – A notification style widget which slides into a corner of the page (see knowledge hub).
- Pop Up Takeover – A Pop Up message which takes over the screen until clicked.
- Side Bar – A side bar which enters from the right including image, text and call to action.
- Tooltip Widget – A tooltip which can be used to explain or draw attention to an element or feature.
Advanced Page Targeting Snippets
The following scripts can be used with your web experiences by copying the snippet into the Advanced Page Targeting block to ensure the web experience is only executed when the specific event occurs:
- OnClick – Triggers the experience when user clicks the specified HTML element.
- OnDelay – Triggers the experience after a delay.
- OnExit – Triggers the experience when user moves their mouse out of the browser window.
- OnHover – Triggers the experience when user moves their mouse over the specified HTML element.
- OnScroll – Triggers the experience when the user has scrolled a certain percentage of the page.
- SpaTargeting – This function can be used in Advanced Page Targeting to allow an experience to trigger on every virtual page load, rather than only on full page loads. It can be used along with other page targeting functions to trigger experiences after a delay or on hover over an element etc.
Decision Model Snippets
Most Viewed Page Decision Model – This decision model will get the most viewed page from your customer’s sessions and return relevant content for you to display.
Sitecore Personalize decision models enable users to model and run decisions using business rules. You can create reusable programmable decision templates using JavaScript for use within your models. The following are examples of programmable functions you might use as a decision template:
- getNumberOfEvents – This function will return the number of events of the specified type in the provided session.
- getTriggerEvent – This function will return the order that triggered the execution of the experience. This is for use in triggered experiences where the trigger is Custom Trigger.
- getTriggerOrder – This function will return the order that triggered the execution of the experience. This is for use in triggered experiences where the trigger is Order Created or Order Updated.
- getTriggerSession – This function will return the session that triggered the execution of the experience. This is for use in triggered experiences where the trigger is Session Closed or Abandoned Cart.
Audience Filter Snippets
Sitecore CDP allows you to target an audience in a triggered experiment and there are a few different ways you can achieve this. If you want to target a real-time audience you can apply JavaScript either via a reusable Audience template or direct JavaScript that can be added to the Experiment. The following JavaScript snippets are included in the library:
- checkDataExtensionNumberValue – Checks for a specified numeric data extension field value.
- checkDataExtensionStringValue – Checks for a specified string data extension field value.
Credit
Thanks to the team at Sitecore for pulling this awesome collection of snippets together. They provide lots of insight and certainly help stir some creativity.
Useful links
- Managing Programmable Decisions
- Targeting audiences in a triggered experiment
- Create a Web Template
- Create an Audience Template
- Create a Decision Template
Have Fun!