Logic Operator

Control how your cloaking filters are evaluated using AND / OR logic.

โœ… What is Logic Operator?

The logic_operator parameter determines how multiple targeting filters in Campaign Builder (such as country, device, OS, browser, UTM, etc.) are evaluated together.

It defines whether:

  • ALL conditions must be met (AND)
  • Any ONE condition is enough to pass (OR)

๐Ÿ› ๏ธ Supported Values

  • "AND" โ†’ All filters must match for the visitor to see the offer page
  • "OR" โ†’ Matching just one filter is enough

๐Ÿ“Š AND vs OR โ€“ Key Differences

Logic Requirement Example Match Result
AND All filters must be true โœ… country + โœ… device + โœ… OS + โœ… browser = MATCH
OR At least one filter must be true โœ… country + โŒ device + โŒ OS = MATCH

๐Ÿ”„ How Multi-Value Filters Work

Each filter (like country, device, OS, browser) can accept multiple values, separated by |. XCLO will evaluate whether the visitor matches at least one value in each group.

Example:

  • allow_browser = chrome|firefox|safari โ†’ A visitor using Chrome = โœ… match
  • allow_device = desktop|smartphone โ†’ A visitor on smartphone = โœ… match

But the final result depends on the logic operator:

  • AND โ†’ All filter groups must match at least one value
  • OR โ†’ Matching any one group is sufficient

๐Ÿ’ฌ Plain English Analogy

  • Each filter group is a gate
  • Each gate accepts multiple keys (allowed values)
  • If a visitor has any valid key for the gate โ†’ โœ… access granted for that gate
  • With AND: All gates must open
  • With OR: One open gate is enough

๐Ÿงพ Example Configuration in index.php

$rawConfig = [
  'allow_country'   => 'id|my',
  'allow_device'    => 'desktop|smartphone',
  'allow_browser'   => 'chrome|firefox',
  'allow_os'        => 'android',
  'logic_operator'  => 'AND'
];

๐Ÿ” Example Debug Output

Using AND Logic:

{
  "match": false,
  "reason": "OS not allowed"
}

Even though country, device, and browser match โ€” OS does not โ†’ match fails.

Using OR Logic:

{
  "match": true,
  "reason": "Matched: country"
}

Only country matches, but that’s enough because logic is OR.

๐ŸŽฏ When to Use AND

  • High-risk campaigns (e.g., Facebook, Google, TikTok)
  • Strictly targeted CPA offers
  • Traffic where full compliance is mandatory

๐ŸŽฏ When to Use OR

  • Testing broad traffic sources
  • Push traffic or low-barrier campaigns
  • When exploring conversion from different segments

โš ๏ธ Important Notes

  • Use uppercase for AND or OR
  • Do not use smart quotes (โ€œ โ€) โ€” use plain double quotes (“)
  • Always test your config using Debug Mode before running traffic

๐Ÿ’ก Best Practices

  • Use AND to filter only high-quality traffic
  • Use OR when you’re optimizing for volume
  • Combine with UTM logic for advanced segmentation
  • Document test results to understand which filters work best