Skip to Content
Core ConceptsTargeting

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

  1. A visitor arrives at your site
  2. Foir evaluates targeting rules for each variant
  3. Rules check conditions like “is the user on mobile?”
  4. The first matching variant (by priority) is displayed
  5. 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

TypeOperators
Equalityequals, does not equal
Numbersgreater than, less than, etc.
Textcontains, starts with, ends with
Listsis in, is not in
Existenceis empty, is not empty
Booleanis 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:

ContextValuesDescription
devicemobile, tablet, desktopDetected from screen size
platformweb, ios, androidWhere the request came from
auth-statusauthenticated, anonymousWhether user is logged in

Custom Contexts

You create these based on your needs:

Market Context

  1. Go to Settings > Contexts
  2. Create a context called “Market”
  3. Add allowed values: UK, US, APAC, etc.
  4. Set how it’s passed (header, query param, etc.)

Locale Context

  1. Create a context called “Locale”
  2. Add languages: en, en-GB, es-MX, fr-CA, etc.

Customer Segments

  1. Create a context called “Segment”
  2. Add segments: VIP, first-time-buyer, high-value, etc.
  3. Configure how segment membership is determined

Passing Context

Context values are determined from:

  1. Request headers: x-market: uk
  2. Query parameters: ?market=uk
  3. URL path: /uk/en/products/...
  4. Defaults: Configured fallback values

Using Targeting

For Variants

Target content to specific audiences:

  1. Edit a page
  2. Create or select a variant
  3. Click Targeting Rules
  4. Build your rule:
    • Add condition: Device equals mobile
    • Add condition: Market equals UK
    • Set logic: AND
  5. Set priority (higher = checked first)
  6. Save

For Field Visibility

Show or hide fields based on other values:

  1. Edit an entity type
  2. Select a field
  3. Add a Conditional Rule
  4. 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

  1. Open any content with variants
  2. Click Preview
  3. Use the context selector to simulate:
    • Different devices
    • Different markets
    • Different segments
  4. 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

  1. Start with device - Mobile optimization is usually the first need
  2. Use the catalog - Store common rules for reuse
  3. Set clear priorities - More specific rules should have higher priority
  4. Always have a default - Ensure content displays when no rules match
  5. Test thoroughly - Check all combinations before publishing
  6. Keep rules simple - Complex rules are hard to maintain and debug
  7. Document intent - Name rules clearly so others understand them

Common Patterns

Mobile First

Priority 10: Device is mobile → Mobile variant Priority 0: Default → Desktop variant

Regional Content

Priority 10: Market is UK → UK variant Priority 10: Market is US → US variant Priority 0: Default → International variant

VIP Experience

Priority 20: Segment includes VIP → VIP variant Priority 10: Device is mobile → Mobile variant Priority 0: Default → Standard variant

Authenticated Users

Priority 10: Auth status is authenticated → Member variant Priority 0: Default → Public variant

Next Steps

  • Variants - Apply targeting to content variants
  • Routing - How targeting affects URL resolution
  • Entities - Content structure overview
Last updated on