Once you create a segment, you define one or more characteristics that contain the conditions, upon which Sitefinity CMS serves personalized content to the segment. Such conditions may be IP address, Location, Landing URL, and so on. Sitefinity API supports programmatic creation of the following characteristics by:
Segment characteristics are represented programmatically as objects of type Criterion (Telerik.Sitefinity.Personalization.Impl.Model.Criterion). To create a Criterion, you need to instantiate a new object of type Criterion and set its properties:
IMPORTANT: Make sure you use the property names provided in the code samples in this section.
The following samples give more details how to use the properties, listed above:
To create a criterion by user role you pass the role Id and Name and set the CriterionValue in the proper format:
Creating a criterion by IP address is as simple as passing the IP address as string and setting the address to the CriterionValue property in the proper format:
Creating criteria by Landing URL or Querystring introduce an added functionality of using a criterion operator. Since these criteria allow you to specify a desired value and a second value to compare to, you also need to choose which operator to use for the comparison of the two. Thus, you can set conditions, such as “this characteristic is valid for visitors that land on an URL that contains/equals/starts with etc. the following value” The supported criterion operators are:
The following example demonstrates how to create a Landing URL and use the criterion operators, listed above:
The similar logic applies when creating a criterion by QueryString:
To create a Time of day criterion, you need to pass two different DateTime values when building the CriterionValue – one for the start time and one for end time of the specified timeframe of the visit. For example, the criterion applies to visitors that browse the website between 9am and 5pm:
Similar to the Time of day criterion, when working with Page visit duration criterion, you need to pass two values to specify min and max duration. You also specify the time unit.
NOTE: Supported values for time unit are “seconds” or “minutes”.
Back To Top
To submit feedback, please update your cookie settings and allow the usage of Functional cookies.
Your feedback about this content is important
Copyright © 2022 Progress Software Corporation and/or its subsidiaries or affiliates.
All Rights Reserved.
Progress, Telerik, Ipswitch, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks for appropriate markings.
Powered by Progress Sitefinity