Conditions Overview

Documents / Conditions

A condition is a rule. Everyday meaning: “only if this is true.” In CROForge, a condition compares a real value (a visitor attribute, an event property, or the current page URL) to an expected value using a match type (how to compare).

You will meet the same building blocks in three places: who can enter an experiment (segments), which events count as a metric, and which pages an experiment may run on.

Words used on this page

WordEveryday meaningMeaning in CROForge
ConditionA rule that must be trueOne comparison: data type + match type + value (or a pack of URL rules)
Match typeHow to compare two thingsThe operator (Exact, Contains, Starts with, Regex, Between, URL match, and so on)
ExactThe whole thing is the sameString or URL equals the expected value
ContainsThis text appears somewhere insideSubstring match
Starts withIt begins with this textPrefix match — common for “whole site except…”
RegexA pattern language for textRegular expression test; a bad pattern fails closed (no match)
Include vs excludeAllow vs blockURL targeting: at least one include must match, and no exclude may match
ANDEvery item must be trueSegment conditions usually all pass; metric conditions all pass for that event
ORAny item may be trueInside a text condition’s list of strings, any one value can satisfy the match
AttributeA fact about a visitorWhat segment conditions compare (device, UTM, visitor type, and more)
Event propertyA fact attached to something that happenedWhat metric conditions compare (click text, amount, target URL)
URLThe address of a pageWhat experiment Pages compare; also a data type that uses URL-rule packs
Originhttps:// plus the host (and port if any)Part of the cleaned URL Smart Code compares
PathnameThe path after the host, like /pricingCombined with origin after query and hash are stripped
Query stringThe ?utm_source=google part of a URLStripped before runtime URL compare
HashThe #section part of a URLStripped before runtime URL compare
Data typeWhat kind of value it isText, Number, Boolean, or URL — this decides which match types appear
SegmentA named group of visitorsA list of attribute conditions; attached as experiment Audience
MetricA success number you want to moveAn event plus optional property conditions

Screenshot

Use this screenshot filename when you add a capture: conditions-builder.png in docs/assets/placeholders/. Do not embed an image in this file.


Where conditions appear

SurfaceWhat is comparedEveryday example
Segment conditionsVisitor attributes“Device is desktop” AND “UTM source is google”
Metric conditionsEvent properties“Click text is Book Demo” or “Amount is between 100 and 200”
Experiment pagesCurrent page URL (include / exclude)“Starts with https://example.com” AND not “Contains /blog”

The shared condition UI lives under components/common/condition-rule/*. Experiment Pages use the same include/exclude idea with URL rules.

Building blocks

Every condition is assembled from the same three pieces:

  1. Data type — Text, Number, Boolean, or URL. This is the kind of value, and it decides which operators the UI offers.
  2. Match type — the operator allowed for that type (Exact, Contains, Greater than, URL match, and so on).
  3. Value — a string list, a number or range, a boolean, or a URL rule array.

Text conditions often store a JSON array of strings and match if any item matches (OR within the list). Segment-level logic is still AND across conditions.

Evaluation mindset

  • Segment: usually all conditions must pass (AND). An empty “All traffic” style segment matches everyone.
  • Metric: all metric conditions must pass for that event before the metric counts.
  • URL targeting: include must match and exclude must not. In other words includeMatch && !excludeMatch.

Runtime URL compares typically use origin + pathname, with trailing slash normalized and query string / hash stripped. Write patterns that match that cleaned form. Full operators are in Match types. URL packs are in URL rules.

Related reading