Conditions
Conditions are the logic layer that connects variables to behavior. They control which page a visitor navigates to, when a component is visible, which styles are active, and what property values apply. Conditions appear in four places throughout AppFunnel:
- Routing — determine which page to navigate to next
- Dynamic Properties — conditionally override any property value
- Active Style — trigger the active visual state on a component
- Visibility — show or hide components based on variable values
How Conditions Work
A condition compares a variable’s current value against a target using an operator:
variable operator value
───────── ───────── ─────
answers.experience equals "advanced"When the condition evaluates to true, the associated behavior triggers (navigate to a page, apply a style, show a component, etc.).
Operators
AppFunnel provides 12 condition operators. The operators available for a given variable depend on its type.
Full Operator Reference
| Operator | Description | Example |
|---|---|---|
equals | Exact match (loose equality) | answers.goal equals "profit" |
notEquals | Does not match | answers.goal notEquals "profit" |
contains | String includes substring | user.email contains "@gmail" |
notContains | String does not include substring | user.email notContains "@test" |
greaterThan | Numeric greater-than | answers.budget greaterThan 100 |
lessThan | Numeric less-than | page.timeOnCurrent lessThan 60 |
exists | Value is not null, undefined, or empty string | user.email exists |
notExists | Value is null, undefined, or empty string | user.email notExists |
includes | Array contains a specific value | answers.interests includes "electronics" |
notIncludes | Array does not contain a specific value | answers.interests notIncludes "clothing" |
isEmpty | String is blank or array has no items | answers.interests isEmpty |
isNotEmpty | String is non-blank or array has items | answers.interests isNotEmpty |
Operators by Variable Type
Not all operators apply to every variable type. Here is which operators are available for each type:
| Type | Available Operators |
|---|---|
| string | equals, notEquals, contains, notContains, exists, notExists, isEmpty |
| number | equals, notEquals, greaterThan, lessThan, exists, notExists |
| boolean | equals, notEquals, exists, notExists |
| stringArray | includes, notIncludes, equals, notEquals, greaterThan, lessThan, isEmpty, isNotEmpty, exists, notExists |
For stringArray variables, equals, notEquals, greaterThan, and lessThan compare against the array length, not the array contents. Use includes to check if a specific value is in the array.
Condition Groups
Multiple conditions can be combined into groups using AND or OR logic.
AND Groups
All conditions must be true for the group to match:
AND:
answers.experience equals "advanced"
answers.budget greaterThan 500
answers.goal equals "profit"This matches only when the visitor is experienced, has a budget over 500, and their goal is profit.
OR Groups
At least one condition must be true for the group to match:
OR:
answers.experience equals "advanced"
answers.experience equals "intermediate"This matches when the visitor has either advanced or intermediate experience.
Nested Groups
Groups can be nested for complex logic:
AND:
answers.goal equals "profit"
OR:
answers.experience equals "advanced"
answers.budget greaterThan 1000This matches when the goal is profit and the visitor is either advanced or has a high budget.
Where Conditions Are Used
Conditions drive behavior across AppFunnel:
- Routing — Determine which page to navigate to next. Routes are evaluated top to bottom; first match wins.
- Dynamic Properties — Conditionally override any property value (visibility, text, colors, click actions).
- Active Style — Toggle a component’s visual state based on a single condition.
Liquid Expressions in Conditions
For advanced logic, conditions support Liquid expressions as the left-hand value. Instead of referencing a variable directly, you write a Liquid template that computes the value to compare.
This is powerful when you need to evaluate computed values or combine multiple variables.
Example: Compare computed value
Expression:
{{ products.yearly.rawPrice | divided_by: 12 | round: 2 }}Operator: lessThan
Value: 10
This condition is true when the yearly plan’s monthly equivalent is less than $10.
Example: Check combined string
Expression:
{{ answers.experience }}-{{ answers.goal }}Operator: equals
Value: advanced-profit
This condition matches a specific combination of two answers.
When a Liquid expression evaluates to a numeric string, it is automatically converted to a number for comparison. The expression {{ 5 | plus: 3 }} evaluates to the number 8, not the string "8".
Evaluation Behavior
Understanding how conditions evaluate edge cases helps you build reliable logic:
equalsuses loose equality —"42"equals42(string-number coercion).existschecks for non-empty — a value “exists” when it is notnull, notundefined, and not an empty string"". Note:0andfalseare considered to exist.isEmptyon arrays checks.length === 0. On strings, it checks.trim() === "". On other types, it checks for falsiness.containsis case-sensitive —"Hello"does not contain"hello". If you need case-insensitive matching, use a Liquid expression withdowncase.- Unknown operators always evaluate to
false. - Empty condition groups (no rules) always evaluate to
true.