Over 10 years we help companies reach their financial and branding goals. Engitech is a values-driven technology agency dedicated.

Gallery

Contacts

411 University St, Seattle, USA

engitech@oceanthemes.net

+1 -800-456-478-23

Sitecore (Koushik) Technology

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!

Leave a comment

Your email address will not be published. Required fields are marked *

×