# Can I target users who completed a goal in a previous session?

Asked by rcastillo on 2025-12-16. Tags: cql, audiences, goals, events.

We track a goal called checkout-started via `goalCompleted` when a user enters checkout. Some of them never finish. On their next visit I want those users to see a reassurance banner (free returns, secure payment, the usual).

So the targeting I need is "completed goal checkout-started at some point in the past". Are goal completions queryable in CQL across sessions, or do goals only exist as experiment metrics? I could not find a clear statement in the docs and I dont want to duplicate the tracking with a custom attribute if the condition already exists.

## 2 answers

### Accepted answer from olga_v (2025-12-16)

Goal completions are queryable directly:

```cql
user has completed goal "checkout-started"
```

Goals reference events that are already being tracked, whether that is your explicit `goalCompleted` call with a `goalId` or one of the auto events, so no duplicate tracking needed.

On the cross-session part: behavioral history persists on the user profile across sessions within your plan's retention window, so previous-session targeting is the normal case here, not a workaround. Compose it with the incompleteness check for your exact banner audience:

```cql
user has completed goal "checkout-started" and not user has made purchase
```

That gives you "started checkout before, never bought" on any later visit.

### Answer from jaim (2025-12-17)

Since your use case is basically abandonment: cart abandonment has its own dedicated condition with a frequency form built in:

```cql
user has abandoned a cart at least 2 times
```

It is backed by the `cartAbandoned` auto event, so if your store integration tracks carts you get it for free. The frequency threshold is nice for reserving the strongest reassurance messaging (or a discount) for repeat abandoners instead of everyone who ever bounced from checkout once.
