JS expression condition

For onsite campaigns you can use a new type of comparison in your conditions: JS expression

JS expression is a bit different than the rest but open you the door for unlimited validations. For example:

Examples

String expressions:

Integer/Float values expressions:

Expression usage:

  • JS expression you enter on the right must return true or false. Any other returned value will be considered false.
  • maximum length of expression is 50 characters.
  • the expression string you enter is evaluated using JS eval method.
  • (x) from the expression gets replaced with the real value of the condition:
    • if it’s null then it will be replaced with null
    • if it’s string make sure you put it into quotes
    • make sure you add those parentheses without spaces

Potential use cases:

  • display a campaign every 3 pages: (x)%3==0
  • length of utm term or search query is exactly 3 characters. “(x)”.length==3

Related Articles