december 16, 2016
Sitecore's personalization rules are incredibly robust and allow for the creation of very complex conditions which can fine tune the delivery of your targeted content to the desired subsets of visitors.
To target your content, you to need to configure your detailed condition on the component, and depending on how your content is organized, you may have multiple locations on a page, or multiple locations across pages that need to use the same set of conditions. Thankfully, Sitecore has thought of this scenario. Rather than following the arduous task of recreating the conditions in each location, you can create a predefined condition once, which you can then reference in multiple locations. This eases the overhead of configuring your personalization as well as lowering the cost of maintenance should your set of conditions need to be edited.
Let's take a look at how it all works
Sitecore ships with number of predefined conditions which can be found in the following location:
/sitecore/system/Marketing Control Panel/Personalization/Predefined Conditions
Let's assume we have a scenario where we need to create a personalization condition so that people in Canada, the United States, and Brazil all see the same targeted content for specific components, while everyone else sees the default content.
In such a scenario, if we didn't know about predefined conditions, we would need to recreate the conditions in all of the applicable components to do the proper content swapping. Instead, we can create a predefined condition which we then reference on the personalized components. Such a predefined condition would look like:
Now, when configuring the personalization rule on the component itself, we want to leverage the "where predefined condition is true" condition:
We would then configure it to point at our Custom Country Condition condition and we are done:
That’s it. Now, should we need to update our condition, we can do so in a single place rather than having to edit the personalization rules on all of the different components.