---
title: Event history filter
slug: event-history
description: How the Event history filter works in Personizely targets: counting custom and commerce events by name, ply.trackEvent, date windows and the current session.
docTags: 
createdAt: 2026-10-17T09:52:08.369Z
---

The Event history filter matches visitors by how many times an event with a given name was recorded for them, such as "performed `add_to_cart` at least 2 times" or "performed `quiz_completed` at least 1 time during this session". Events come from your own code through `ply.trackEvent` and from the commerce events Personizely records on supported platforms.

**Available on:** all platforms.
**Plan:** Premium.

## How it's evaluated

Personizely counts the events recorded for the visitor whose name equals the event name you type, optionally within a date window or the current visit, and compares the count with your number.

- **Events tracked on the current page count right away.** An event sent with `ply.trackEvent` on this page is included the next time the filter is checked, for example when a widget's trigger fires.
- **Visitor history loads first.** Filters that need visitor history may take a moment to resolve; content that depends on them stays hidden until they do. With **During this session**, the filter resolves right away.

### Which events count

| Source                                                      | Event names                                                                                                          |
| ----------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| Your code: `ply.trackEvent('name')`                         | The name you pass, for example `quiz_completed`. See the [JavaScript API (window.ply)](docId\:d64TegyOiwNA2GFG1eXPm) |
| Built-in commerce events, where your platform supports them | `purchase`, `add_to_cart`, `checkout_start`. See [Goals](docId\:XSkE1LjM1yiNhLBzpr1B1)                               |

```javascript
// Record an event when a visitor finishes your product quiz
ply.trackEvent('quiz_completed');
```

## Options

The filter reads: **Performed the** *event name* **event** *at least / less than* *N* *times*, with an optional date window.

| Option                 | What it does                                       | Values / default                 |
| ---------------------- | -------------------------------------------------- | -------------------------------- |
| Event                  | The exact event name to count                      | Required. Example: `add_to_cart` |
| at least / less than   | "At least N" includes N; "less than N" excludes it | **at least**                     |
| N                      | The number of events to compare with               | Default **1**                    |
| Date window (optional) | Count only events in the window                    | Off                              |
| In the last N days     | From the start of the day N days ago until now     | Default **3** days               |
| On or after / Before   | On the selected date or later / before it          | Date                             |
| During this session    | Only events in the visitor's current visit         |                                  |

## Behavior details

- **Exact, case-sensitive names.** `quiz_completed`, `Quiz_completed` and `quiz-completed` are different. Event names sent with `ply.trackEvent` must be lowercase letters, digits and underscores, so type the name the same way here.
- **Every call counts.** Calling `ply.trackEvent('size_guide_open')` three times records three events.
- **Commerce events from your store platform.** Purchases on Shopify and Wix, and add-to-cart and checkout-start events on Shopify, are recorded from the platform's own data rather than by your pages. They count once recorded, from the next page the visitor loads, with no date window or with a date window. They aren't counted with **During this session**, which counts only events tracked by your site's pages during the visit.
- **Event values aren't compared.** The filter counts events; the value passed to `ply.trackEvent` doesn't matter here.
- **New visitors** have no events, so "at least" doesn't match them and "less than" does.
- **Per browser.** History is tied to the visitor's browser profile; clearing cookies or switching device starts again at 0.
- **Goals or events?** If you've already made a [Goals](docId\:XSkE1LjM1yiNhLBzpr1B1) for the event, the [Goal history filter](docId:-4jySLfqdzYfvDqDrBG-q) filter gives the same audience and lets you reuse the goal's product, tag and page settings.

## Examples

- **Quiz takers:** Performed the `quiz_completed` event **at least 1** time, with a popup recommending the quiz result's bundle.
- **Repeat add-to-carts without checkout:** two filters in a group set to **all**: `add_to_cart` **at least 2** times **In the last 1 days**, and `checkout_start` **less than 1** time **In the last 1 days**. Pair it with a cart reminder bar.
- **App users:** call `ply.trackEvent('app_banner_click')` from your own banner, and hide it with Performed the `app_banner_click` event **at least 1** time.

## Related

- [JavaScript API (window.ply)](docId\:d64TegyOiwNA2GFG1eXPm)
- [Goals](docId\:XSkE1LjM1yiNhLBzpr1B1)
- [Goal history filter](docId:-4jySLfqdzYfvDqDrBG-q)
- [Widget history filter](docId\:ay2ODKE7j7zS4TXMlrdJg)
- [Targets](docId\:tWNdHNIcvVf9rNerxrynw)
