Managing Rules

Rules are defined using operators that are applied on data, with and, or or not conditions between them.

Supported operators and data types

The following are the supported operators and data types that can be filtered:

Operators

Operator

Description

i_contains

Contains substring (case insensitive).

i_not_contains

Does not contain substring (case insensitive).

eq

Equal to (case sensitive).

neq

Not equal to (case sensitive).

lt

Less than (for numeric fields only).

lte

Less than or equal to (for numeric fields only).

gt

Greater than (for numeric fields only).

gte

Greater than or equal to (for numeric fields only).

regex_match

Matches a regular expression (for example: “example.com.*purchase$”). The full PCRE grammar is supported.

Data types

Data

Description

url

The full URL of the site visited.

domain

The domain of the site visit.

path

The path of the site visited (not including the domain).

Any custom data field

Any data sent through query parameters of a tag firing, including pre-defined “ec”, “ea”, “el” and “ev” values. Examples: productId, category, price.

Sample rules

Rule: All referrer URLs containing the string “jackets” will be matched.

Example:

  {
  "url": {
    "i_contains": "jackets"
  }
}

Rule: All referrer URLs not containing the string “jackets” will be matched.

Example:

  {
  "url": {
    "i_not_contains": "jackets"
  }
}

Rule: All referrer URLs not containing the string “flowers” and “chocolate” will be matched.

Example:

{
    "not": {
        "and": [
            {
                "url": {
                   "i_contains": "flowers"
                }
            },
            {
                "url": {
                   "i_contains": "chocolate"
                }
            }
        ]
    }
}

Rule: All referrer URLs containing jackets or gloves, and also containing category1 or category2.

Example:

{
    "and": [
        {
            "or": [
                {
                    "url": {
                       "i_contains": "jackets"
                    }
                },
                {
                    "url": {
                       "i_contains": "gloves"
                    }
                }
            ]
        },
        {
            "or": [
                {
                    "url": {
                       "i_contains": "category1"
                    }
                },
                {
                    "url": {
                       "i_contains": "category2"
                    }
                }
            ]
        }
    ]
}

Rule: This custom event rule will match if all of the following custom event field conditions are true: ec = ‘button’, ea = ‘click’, el = ‘Product demo’, and ev is greater than 5.

Example:

“and” :
[
    {
      "ec": {
        "eq": "button"
      }
    },
    {
      "ea": {
        "eq": "click"
      }
    },
    {
      "el": {
        "eq": "Product demo"
      }
    },
    {
      "ev": {
        "gt": "5"
      }
    },
]