Friday, 29 March 2024

Custom Personalization Rules in Sitecore

March 29, 2024 0



In my previous blog, I detailed the setup and management of the out-of-the-box (OOTB) personalization feature within a component. Today, I delve deeper into building and creating custom personalization rules to meet specific business requirements. Sitecore's architecture offers the flexibility needed for this scenario, allowing for the extension and implementation of custom rules as required. To illustrate, we'll focus on creating a custom rule that alters content displayed to site visitors based on a "querystring" parameter value.

To implement custom personalization, follow these steps:

Step 1: Navigate to " /sitecore/system/Settings/Rules/Definitions/Tags " and right-click on "Tags" to add a new customized Tag (e.g., QueryString Name Value Tag)


Step 2: Under " /sitecore/system/Settings/Rules/Definitions/Elements ", create a custom Element folder (e.g., QueryString Name Value Tag) and add a new condition within it. Set the Text and Type properties of the condition.

Text property: Provide a descriptive condition for the rule visible to content editors.

Type Property: Specify your class name along with its namespace followed by the assembly name, where the business logic for your personalization rule resides.

Step 3: Add the created tag to the default tag, within the Tags property of the element folder.

Step 4: Proceed to " /sitecore/system/Settings/Rules/Conditional Renderings " to include this tag in conditional rendering. This ensures the new rule is accessible in the rule editor for content editors to personalize components.


Step 5: Next, write the business logic for your personalization rule as required. You can download the sample code from this link , file name is QueryStringNameValueCustomRule.cs 


Step 6: In the Experience Editor, open a page, select the component for personalization, and click "Personalize." Then, click "New Condition" and add the rule according to your specifications. Click "Edit" to define the rule, where you'll find the custom rule you created. Select the custom rule, assign values as needed, and publish the page.


Step 7: Finally, on the public site, set the querystring as expected, and witness the personalized content tailored to your specifications.



I took references from this Sitecore Documentation Link while implementing and write down this blog.

Happy Sitecoring!

Friday, 15 March 2024

Basic Introduction on Sitecore Personalization

March 15, 2024 0

 


In this blog post, I'll provide an overview of personalization in Sitecore, outlining its benefits and offering step-by-step guidance on creating and configuring personalization for components. This guide is tailored for Sitecore beginners seeking to grasp the concept and its implementation.

Personalization empowers you to deliver customized content to your visitors. For instance, you can establish rules that display personalized content based on visitors' browsing patterns and their accumulated profile values.

This capability is crucial as it ensures that users are presented with content that aligns with their interests and preferences.

Approaches to Personalization:

  • Rules-based Personalization: The content editor establishes conditions dictating when content is delivered to a customer. These conditions can include factors such as visitor location or IP address, device type, keywords used to access the site, or completed website goals. The Rule Editor manages three key objects: Conditions, Actions, and Rules.
  • Adaptive Personalization: Utilizing visitor profiles and pattern-card matching, content is dynamically adjusted in real-time to suit individual visitors. Adaptive Personalization rules can be set using Sitecore XP’s Rules Set Editor.
  • Historical Personalization: Content can be personalized based on a contact’s past behavior rather than their current session actions. This approach acknowledges the significance of context preceding and following the present.
  • Test and Personalize: Sitecore XP facilitates A/B and multi-variant testing, either through pre-configured options or manual setup. Test results inform content optimization efforts aimed at improving conversion rates aligned with site goals. Testing also helps determine which content resonates best with specific visitor segments.
  • Journey-based Personalization: Design intricate user journeys within Sitecore XP using advanced business logic. These journeys aid in assessing customer progression with your brand and allow for the implementation of triggers to guide customers through their journeys based on their current stage.

Personalizing the Component:

It's important to note that for personalizing a component, ensure that the component you're targeting supports a datasource. This enables us to assign different contents based on various criteria.

Below are the steps to configure personalization for a specific component:

  1. Select the component you wish to personalize. You can choose the component from either the presentation or the Experience editor. We'll proceed with the Experience editor for this demonstration.


  2. Begin by selecting the component and clicking on the "Personalize" button.

  3. Next, click on the "New Condition" button and add the rule according to your requirements. Click on the "Edit" button to specify the rule.


  4. Let's consider a simple rule, such as displaying specific content if the current month is March.


  5. Now select the data source for March month rule


  6. Additionally, you can define a default or fallback component datasource. If none of the conditions match, the default will be utilized.


  7. Once the configurations are completed on the component, you'll notice an indicator in the presentation indicating that personalization has been applied to the specific rendering/component.



  8. You can also view the indicator from content editor.


  9. Upon saving and publishing the page, during the current month of March, it will display March-specific data.


If the rule is altered to set the month value to April, it will revert to displaying the default value.



In the Rule Set Editor, the personalization conditions are organized by category. The categories are:
  • Campaign
  • Channel
  • Date
  • Device
  • Fields
  • IP Geolocation
  • Item hierarchy
  • Item information
  • Item version
  • Marketing Automation
  • Security
  • Sitecore query
  • System
  • Tracking
  • Venue
  • Visit
  • Visitor
  • xDB
In the next blog we will discuss on how to create and implement custom personalization rules.

Happy Sitecoring!