Targeting
Targeting rules determine which content variant to show to each visitor. Build rules based on device type, authentication status, geographic market, customer segments, and more.
How Targeting Works
- A visitor arrives at your site
- Foir evaluates targeting rules for each variant
- Rules check conditions like “is the user on mobile?”
- The first matching variant (by priority) is displayed
- If nothing matches, the default variant is shown
Building Rules
Simple Conditions
A condition compares a value against a target:
- Device equals mobile
- Market equals UK
- Segment “VIP” is true
Combining Conditions
Use AND/OR to create complex rules:
AND (all must be true):
- Device is mobile AND Market is UK
OR (any can be true):
- Market is UK OR Market is US OR Market is Canada
Nested groups:
- Segment is VIP AND (Device is mobile OR Market is UK)
Available Comparisons
| Type | Operators |
|---|---|
| Equality | equals, does not equal |
| Numbers | greater than, less than, etc. |
| Text | contains, starts with, ends with |
| Lists | is in, is not in |
| Existence | is empty, is not empty |
| Boolean | is true, is false |
Context Dimensions
Context dimensions are the values you can target. Some are built-in, others you create.
Built-in Contexts
These are always available:
| Context | Values | Description |
|---|---|---|
device | mobile, tablet, desktop | Detected from screen size |
platform | web, ios, android | Where the request came from |
auth-status | authenticated, anonymous | Whether user is logged in |
Custom Contexts
You create these based on your needs:
Market Context
- Go to Settings > Contexts
- Create a context called “Market”
- Add allowed values: UK, US, APAC, etc.
- Set how it’s passed (header, query param, etc.)
Locale Context
- Create a context called “Locale”
- Add languages: en, en-GB, es-MX, fr-CA, etc.
Customer Segments
- Create a context called “Segment”
- Add segments: VIP, first-time-buyer, high-value, etc.
- Configure how segment membership is determined
Passing Context
Context values are determined from:
- Request headers:
x-market: uk - Query parameters:
?market=uk - URL path:
/uk/en/products/... - Defaults: Configured fallback values
Using Targeting
For Variants
Target content to specific audiences:
- Edit a page
- Create or select a variant
- Click Targeting Rules
- Build your rule:
- Add condition: Device equals mobile
- Add condition: Market equals UK
- Set logic: AND
- Set priority (higher = checked first)
- Save
For Field Visibility
Show or hide fields based on other values:
- Edit an entity type
- Select a field
- Add a Conditional Rule
- Example: Show “Shipping Address” only when “Delivery Method” is “ship”
For Route Access
Require conditions for certain URLs:
/account/*routes require authentication/admin/*routes require admin role
Testing Rules
The admin UI provides tools to test your targeting:
Preview Panel
- Open any content with variants
- Click Preview
- Use the context selector to simulate:
- Different devices
- Different markets
- Different segments
- See which variant would display
Debug Mode
Enable debug mode to see:
- Which rules were evaluated
- Which conditions matched
- Why a particular variant was selected
Best Practices
- Start with device - Mobile optimization is usually the first need
- Use the catalog - Store common rules for reuse
- Set clear priorities - More specific rules should have higher priority
- Always have a default - Ensure content displays when no rules match
- Test thoroughly - Check all combinations before publishing
- Keep rules simple - Complex rules are hard to maintain and debug
- Document intent - Name rules clearly so others understand them
Common Patterns
Mobile First
Priority 10: Device is mobile → Mobile variant
Priority 0: Default → Desktop variantRegional Content
Priority 10: Market is UK → UK variant
Priority 10: Market is US → US variant
Priority 0: Default → International variantVIP Experience
Priority 20: Segment includes VIP → VIP variant
Priority 10: Device is mobile → Mobile variant
Priority 0: Default → Standard variantAuthenticated Users
Priority 10: Auth status is authenticated → Member variant
Priority 0: Default → Public variantNext Steps
Last updated on