# Criteria

Learn how to use properties to filter events.

Criteria let you filter events based on their properties. Instead of just checking whether an event happened, you can narrow it down to specific details—like whether a user applied a particular coupon, viewed a page with a certain title, or abandoned a specific product.

## Syntax

Criteria use [operators](/reference/cql/expressions/events/criteria/operators) to compare an event property (specified by its `<name>`) against a `<value>`. This enables you to create highly specific filters, such as checking if a value is greater than or less than a certain amount or if a text contains a particular word.

The general syntax for a condition is:

```cql
with /*<name>*/ /*<operator>*/ /*<value>*/
```

If you omit the operator, it implies the [equality operator](operators/equal-to):

```cql
with /*<name>*/ /*<value>*/
```

This is equivalent to using the equality operator explicitly:

```cql
with /*<name>*/ equal to /*<value>*/
```

### Multi-condition criteria

You can combine multiple criteria to create more complex filters.

To check whether *all* conditions are true, use the `and` operator:

```cql
with /*<name>*/ /*<value>*/ and with /*<name>*/ /*<value>*/
```

Use the `or` operator if you want *at least one* condition to be true:

```cql
with /*<name>*/ /*<value>*/ or with /*<name>*/ /*<value>*/
```

To shorten expressions with multiple `and` or `or` operators, you can separate conditions with commas:

```cql
with /*<name>*/ /*<value>*/, /*<name>*/ /*<value>*/ and with /*<name>*/ /*<value>*/
```

You can also group conditions using parentheses to control the order of evaluation:

```cql
(with /*<name>*/ /*<value>*/ and with /*<name>*/ /*<value>*/) or with /*<name>*/ /*<value>*/
```

### Event properties

You can reference event properties by name, but in some cases, properties are nested within other properties. To access nested properties, you have a few options depending on your preference.

Here's an example using the [ownership](/reference/cql/expressions/accessors/ownership) notation:

```cql
with packaging of cart's costs greater than 2
```

Alternatively, you can use the [possessive](/reference/cql/expressions/accessors/possessive) notation:

```cql
with packaging of property costs of cart greater than 2
```

For a more concise option, you can use dot notation (`.`) to directly reference nested properties:

```cql
with cart.costs.packaging greater than 2
```

## Building blocks

These are the parts that make up a condition:

- `name`: `any`

  The name of the [event property](/reference/cql/expressions/events/event-types) you want to filter.

- `value`: `any`

  The value to compare against.

- `operator`: [`Operator`](/reference/cql/expressions/events/criteria/operators)

  The available operators.

## Examples

Compare a numeric property:

```cql
user has abandoned a cart with subtotal greater than 50
```

Check if two properties for equality:

```cql
user has viewed a product with name "Product One", sku "1234"
```

Match one condition or another:

```cql
user has viewed a product with name "Product One" or with sku "1234"
```

Combine multiple conditions with commas:

```cql
user has viewed a product with name "Product One", sku "1234", displayPrice 100
```

Group conditions with parentheses:

```cql
user has viewed a product (with name "Product One" or with name "Product Two"), with brand "Brand"
```

> **Scale plan**
>
> This feature is available only to accounts on the Scale plan. See the [pricing page](https://croct.com/pricing) for more information.
