# Campaign viewed

Learn how to check if a user has viewed campaigns.

This expression checks whether the user has viewed a campaign based on marketing campaign parameters present in [page views](/reference/event/types/web-browsing/page-opened).

## Syntax

The basic syntax for this expression is:

```cql
user has viewed campaign
```

You can optionally include the article for better readability:

```cql
user has viewed a campaign
```

The negation of the expression can be expressed as:

```cql
user has not viewed campaign
```

You can refine the expression with criterias, quantifiers, and time windows:

```cql
user has viewed campaign /*<criteria>*/ /*<quantifier>*/ /*<window>*/
```

## Parameters

- `criteria`: [`Criteria`](/reference/cql/expressions/events/criteria/overview) (optional)

  Additional [filtering criteria](#event-properties) for the campaign viewed event.

- `quantifier`: [`Quantifier`](/reference/cql/expressions/events/quantifier) (optional)

  A quantifier to specify how many times the campaign must have been viewed.

- `window`: [`TimeWindow`](/reference/cql/expressions/events/time-window) (optional)

  The time window during which the campaign must have been viewed.

## Event properties

The following event properties can be used within [criteria expressions](/reference/cql/expressions/events/criteria/overview):

- `name`: `string|null`

  A unique identifier for the campaign. It is usually a short string, such as "summer-sale" or "new-product-launch".

- `source`: `string|null`

  The advertiser, site, or publication generating the traffic. For example, "google", "facebook", or "newsletter".

- `medium`: `string|null`

  The advertising or marketing channel used to reach the user. For example, "email", "video", or "social".

- `content`: `string|null`

  An identification of the specific ad or content the user interacted with. For example, "main-banner" or "newsletter-cta".

- `term`: `string|null`

  The keyword or term that triggered the ad. For example, "running shoes" or "tennis racket".

## Examples

You can check if any campaign was viewed:

```cql
user has viewed campaign
```

Or verify it no campaign was viewed:

```cql
user has not viewed campaign
```

You can also check if the user viewed a specific campaign:

```cql
user has viewed campaign with name "Optimize"
```

Or if the user viewed a campaign at least 2 times:

```cql
user has viewed campaign with name "Optimize" at least 2 times
```

You can even filter by time, such as checking if it was viewed yesterday:

```cql
user has viewed campaign with name "Optimize" yesterday
```

Combine filters, counts, and time windows in one expression:

```cql
user has viewed campaign with name "Optimize" exactly 2 times today
```

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

## Explore

- [Audiences](/explanation/audience): Understand how to delivery content to specific groups of users.
- [Event tracking](/reference/event/types/session/campaign-detected): Learn more about this event.
