Skip to main content

Create a segment

For a video tutorial on targeting segments visit our academy

Segments help you target your visitors. You can create, modify and duplicate segments with Kameleoon's Segment Builder.

Access the Segment Builder

From the App

To access the Segment Builder in the Kameleoon app, click Configure > Segments.

Click New segment to create a new segment. The segment creation pop-in opens.

From the personalization creation page

You can also access Segment Builder while creating or editing a personalization. Click Add a new segment in the Exposed segment section.

The segment creation pop-in opens.

Create a new segment

info

Certain conditions currently found in the segment builder (those that describe how, where, and when a user interacts with your website) will be moved to the trigger builder. Similarly, conditions in the trigger builder that pertain only to segmentation will now be in the segment builder. Existing segments will remain unchanged and continue to function in experiments, but all newly created segments and triggers will follow this new separation. To facilitate the transition, options will be available to help you migrate from the old system to the new one.

Types of segmentation

There are two types of segmentation:

  • A posteriori segmentation takes place after the test. A posteriori segmentation only shows you if a variation's performance has increased in a given segment. Kameleoon doesn't manage this type of segmentation—it's usually handled by your web analytics solution (for example, Google Analytics, KISSmetrics, AT Internet).
  • A priori segmentation is different. The experiment is limited to a specific fragment of you traffic, typically because the test is only relevant for this segment. For instance, if you have a website with international users, you might want to run an experiment for only users in France. Similarly, you could test an offer that only displays to a specific segment (for example, first-time visitors to your website). Kameleoon manages this type of segmentation.

Enter your segment's information

Fill in:

  • Your segment's name
  • The site for which you are creating this segment.
  • The type of campaign for which you are creating this segment (Web experiment/Personalization; Feature flag/SDK experiment; All experiment types).

You can also add a description and tags.

Select and set a condition

To add a condition, drag and drop a condition from the left-hand list to the field on the right.

The pop-in displays the condition's settings once you've dragged and dropped it.

Configure the condition as you wish.

note

The targeting conditions offered in the Segment Builder depend on the chosen campaign type.

Determine a condition's weight

A weight icon lets you prioritize each condition: the higher the number, the more important the condition. This setting is for advanced use only and is not mandatory.

All conditions' weight is one by default.

Delete a condition

Click the X icon to delete a condition.

Narrow or add a new condition

To add a new condition when you've already selected a condition, two options are available:

  • Narrow an existing condition: Further specifies a condition, similar to using mathematical parentheses: (Condition A and Condition B) and Condition C.
  • Add a new condition: Adds a condition at the same level: Condition A and Condition B and Condition C.

For more information, please refer to the FAQ.

Creating effective targeting segments in Kameleoon involves combining various conditions to define your audience. The use of the logical operators AND/OR is crucial in this process. Additionally, understanding the distinction between “include” and “exclude” conditions is essential for accurate segment configuration.

Logical operators: AND vs. OR

AND Operator: Use the AND operator when you want all specified conditions to be met for a visitor to be included in your segment. This operator is ideal for narrowing your target audience to those who meet all of your defined criteria.

  • Example: If you set an AND condition for visitors who are “New Visitors” AND “On Mobile”, only visitors who are both new to your site and accessing it via a mobile device will be included in the segment.

OR Operator: Use the OR operator when you want a visitor to meet any one of the specified conditions to be included in your segment. This operator broadens your target audience to include visitors who meet any one of your criteria.

  • Example: If you set an OR condition for visitors who are “New Visitors” OR “On Mobile”, visitors who are either new to your site or accessing it via a mobile device will be included in the segment.
note

AND is prioritized over OR.

Include vs. exclude conditions

Include Condition: Specifying an “include” condition means that you want visitors who meet this condition to be part of your target segment.

  • True: Visitor possesses the characteristic (for example, “Is a New Visitor” is true).
  • False: Visitor does not possess the characteristic (for example, “Is a New Visitor” is false).

Exclude Condition: Specifying an “exclude” condition means that visitors who meet this condition will not be part of your target segment.

  • True: Visitor does not possess the characteristic (for example, “Is a New Visitor” is true, meaning they are not new, so they are excluded).
  • False: Visitor possesses the characteristic (for example, “Is a New Visitor” is false, meaning they are new, so they are included).

Practical examples and common pitfalls

  • Including New Visitors on Mobile:
    • Condition 1: New Visitor (Only include, True)
    • Condition 2: On Mobile (Include, True)
    • Logical link: AND
    • Outcome: Only new visitors accessing the site on mobile devices will be included.

  • Excluding Returning Visitors on Desktop:
    • Condition 1: New Visitors (Only include, True)
    • Condition 2: On Desktop (Exclude, True)
    • Logical link: AND
    • Outcome: Visitors who are returning and accessing the site via desktop will be excluded.

  • Including Visitors from Specific Acquisition Channels:
    • Condition 1: Acquisition Channel is SEO (Exclude, True)
    • Condition 2: Acquisition Channel is SEA (Include, True)
    • Logical Link: AND
    • Outcome: Only visitors arriving via SEA campaigns and not from SEO will be included in the experiment.

  • Excluding Checkout Process Pages:
    • Condition 1: URL contains /cart (Exclude, True)
    • Condition 2: URL contains /login (Exclude, True)
    • Condition 3: URL contains /payment (Exclude, True)
    • Logical Link: OR
    • Outcome: Pages related to the checkout process will be excluded from the experiment.

tip

Consider the impact of logical operators in conjunction with include/exclude conditions when configuring your targeting segments. Remember that include conditions add visitors to your segment based on positive criteria matches, while exclude conditions remove visitors who meet specific criteria. The choice between AND/OR operators can significantly alter your segment’s scope, either narrowing or broadening the range of included visitors.

If you’re not sure if you’ve set everything up correctly, use the simulation panel.

Targeting conditions

Kameleoon offers targeting conditions that let you include or exclude certain types of visitors.

note

The targeting conditions offered in the Segment Builder depend on the chosen campaign type.

Visited pages

  • Page URL: includes or excludes pages based on their URL or URL fragment.
  • Page Title: includes or excludes pages by title.

With these options, you can target one or more specific pages, which can be useful if you want to change HTML elements shared by several pages. If you target the URL or title page, Kameleoon displays the variation for users on these pages only.

With Kameleoon, you can target any kind of URL using regular expressions. For examples of regular expressions, please read our article about them.

note

For URL targeting using the Contains option: If your expression does not start with http or https, Kameleoon will only check the presence of the expression in the path (everything after the domain name).

caution

URL fragments and regular expressions are case-sensitive.

Acquisition

With acquisition conditions, you can make commercial offers to users based on how they accessed your site.

note

Be careful with the Visitor data and Traffic acquisition targeting options. These conditions are mostly useful for personalization (for example, displaying a commercial offer only to non-buying regular visitors) and must be combined with another condition, like URL targeting.

  • Landing page URL: includes or excludes visitors based on the URL of their landing page.
  • Referring URL: includes or excludes visitors based on the referring URL.
  • Traffic type: includes or excludes visitor based on the website they came from, such as a search engine, an email link, or another referring website.
    • The traffic type condition depends on either the landing page URL or the referrer URL:
      • Emailing if the landing page URL contains the pattern utm_medium=email or utm_medium=newsletter.
      • Search engine (advertising, SEM) if the landing page URL is from a Google domain and has aclk as path, or has the parameter aclk in the query.
      • Search engine (organic, SEO) if the referrer URL contains google, bing, yahoo, yandex, or baidu.
      • Direct if the referrer URL is empty (null).
      • Referrer sites (affiliation) if you have a landing page URL and a referrer URL that does not contain google, bing, yahoo, yandex, or baidu.
  • Acquisition channel: includes or excludes visitors based on the marketing or referral source that brought them to your website.

Visitor characteristics

  • New or returning visitors: includes only new visitors (first visit) or those returning to your website.
  • Browser language: includes or excludes visitors based on the language set in their browser.
  • Geolocation: includes or excludes visitors according to geolocation data (country, state, city).
  • Device type: includes or excludes visitors based on their device (tablet, smartphone, computer). You can also find this feature in the personalization creation flow.
  • Screen resolution: includes or excludes visitors based on the size of their screen (in pixels).
  • Ad blocker: includes or excludes visitors using an ad blocker.
  • Visitor IP address: includes or excludes visitors based on their IP address.

Visiting behavior

  • Previous page: includes or excludes visitors according to the URL of the previous page.
  • Key pages: includes or excludes visitors that have visited a specific key page.
  • Number of page views: includes or excludes visitors according to the number of pages previously visited.
  • Time elapsed since first visit: includes or excludes visitors according to the time elapsed since their first visit.
  • Time elapsed since last visit: includes or excludes visitors according to the time elapsed since their last visit.
  • Number of visits today: includes or excludes visitors according to their number of visits on the current day.
  • Total number of visits: includes or excludes visitors based on their total number of visits to a specific page.
  • Website exit: includes visitors whose cursor has left the browser window.
  • Goal converted: includes or excludes visits during which a specific goal was converted.
  • Product pages: includes or excludes visitors based on previously visited product pages.
    • The product pages category contains three targeting options:
      • Price of the product page displayed: includes or excludes product pages where price is higher than/lower than/equals a certain amount (a fixed price/the price of a specific product/the average price of a selection of products).
      • Number of visited product pages: includes or excludes visitors based on the number of product pages they visited, the category to which these pages belong, and their price.
      • Visited product pages: includes or excludes visitors based on the product pages they visited.
    • If you are using Shopify Plus, the product pages conditions are automatically available without any additional configuration.

Predictive targeting

Kameleoon Conversion Score: our machine-learning algorithms predict each visitor's purchase or engagement intention in real-time. You can use the Kameleoon Conversion Score (KCS) to automatically trigger personalization campaigns. (AI Predictive Targeting is required to activate KCS.)

Campaign

This set of conditions enables you to include or exclude visitors who have seen or not a campaign (experiment/personalization) or variation.

  • Experiment: includes or excludes visitors who have been exposed to a specific experiment and have seen a specific variation or any of the variations (including the original). The condition considers the current visit or the previous ones. The selected experiment can be Online, Paused or Stopped.
  • Personalization: includes or excludes visitors who have been exposed to a specific personalization. The condition considers the current visit or the previous ones. The selected personalization can be Online, Paused or Stopped.
  • Exclusive campaign: excludes visitors already taking part in an experiment, a personalization, or both. This means that:
    • If a visitor has already been exposed to another campaign (in the current or a previous visit), this visitor won't be eligible for your current experiment.
    • A visitor can be targeted by other experiments that do not have the Exclusive campaign condition, even if they are currently part of an exclusive campaign. In other words, this condition doesn't prevent participation in other experiments. It allows visitors to participate in experiments that don't have the same exclusivity requirement.
note

If one of your campaigns or variations is used as a targeting condition in a segment, it cannot be deleted.

External environment

  • Sky condition: includes or excludes visitors based on the weather in their location.
  • Temperature: includes or excludes visitors based on the temperature in their location.
  • Day/Night: Includes or excludes visits during the day or night.
  • Sky condition forecast: includes or excludes visitors based on the forecasted sky conditions in their area.
  • Temperature forecast: includes or excludes visitors based on the forecasted temperature in their area.
  • Date range: includes or excludes visitors during a time range in days.
  • Timeslot: includes or excludes visitors to the website during a certain time range.

Custom data

This set of conditions allows you to include or exclude visits based on custom data. For more information, see this article on advanced targeting tools.

If you set values when creating your custom data, you can select them in the Segment Builder. Choose is among the values in the dropdown and check the values.

Technical

  • Custom JavaScript condition: You can define a custom JavaScript function that returns true or false to determine whether a visitor is includes in an experiment. There are three available options:
    • Check condition immediately: The function executes as soon as possible and continues running until a decision is made. It runs every 75 milliseconds before DOM Ready, then every 250 milliseconds after DOM Ready. To stop the execution, return true to target the visitor or return false to exclude them. For example:
if (window.dataLayer && window.dataLayer.some(layer => layer.pageType === "homepage")) return true; if (window.dataLayer && window.dataLayer.some(layer => layer.pageType !== "homepage")) return false;
  • Wait until the page has loaded: The condition is only checked after DOM Ready, executing every 250 milliseconds until a decision is made. To stop the execution, return true to target the visitor or return false to exclude them. If undefined is returned, the function keeps running in a loop at the defined intervals.
  • Run the condition asynchronously: Use this option when waiting for a response from an API or external service before determining whether a visitor should be included. Instead of returning a value, call setTargeting(true) or setTargeting(false). For example:
const userId = localStorage.getItem("user\_id");
if (!userId) {
setTargeting(false);
return;
}
const apiUrl = `https://api.example.com/check-segment?userId=${userId}`;
fetch(apiUrl, { method: "GET", headers: { "Content-Type": "application/json" } })
.then(response => response.json())
.then(data => {
setTargeting(data?.isInSegment === true);
})
.catch(() => {
setTargeting(false);
});
  • Browser cookie: includes or excludes visitors based on the presence of a cookie in their browser and, if possible, its value.
  • Custom event: starts a personalization when a specific event has been triggered. To trigger an event, use the Kameleoon.API.Events.trigger(eventName) method.
  • Explicit trigger: choose this condition if you only want to trigger the associated campaign explicitly with the Activation API and not via any other built-in conditions. This condition is useful for campaigns implemented on your side with a modern JS framework (for example, React, Vue, Angular).
  • Browser: includes or excludes visitors based on their web browser. You can specify the browser version or target versions that are newer or older to other versions.
  • Operating system: includes or excludes visitors based on their operating system (for example, Windows MacOS).
  • Element on the page: includes or excludes visits based on an element's presence on the page. The condition performs a querySelectorAll loop until the DOM Ready event. After that, the condition returns false.

External tools

Kameleoon provides bridges for CDP, DMP, and analytics platforms, which lets you target segments or cohorts of visitors. See all our integrations here.

Segments

This condition lets you include or exclude visitors based on their segment.

You can import an existing segment into the Segment Builder. Its targeting conditions will then be associated with the new segment you're creating.

For example, suppose you import the Kameleoon segment Returning visitors on mobile that you created and often use as a base. You adapt it to a specific campaign by adding the Goal converted condition, and you create this new segment.

note

Please note that:

  • The conditions that make up the imported segment cannot be modified: the segment is considered as a whole.
  • When you use the same segment as a base in several segments associated with active campaigns, any change will have an impact on all relevant campaigns. Therefore, be careful when modifying your core segment.
  • You can only nest segments one level deep. It's not possible to add a segment that already contains a Kameleoon segment inside another one.

You can use the Kameleoon Segment condition several times to combine multiple segments.