Navigation
← All projects

Cart Abandonment Engine

A quiet session is not always an abandoned cart.

A session timeout sparked a question about unfinished shopping. This project uses simulated clicks to explore when a pause should count as an abandoned cart.

Independent project · Simulated shopping activity, collected continuously and reviewed every hour.

The starting point

When does a shopping pause become an abandoned cart?

A shopping experience involving a session timeout made me think about what a shop can infer from a customer going quiet. Someone may be comparing options or returning later. I used simulated shopping events to explore how those moments become a measurable session.

How can a system distinguish a pause from an unfinished purchase?

The problem behind it

Individual clicks do not describe the whole shopping journey. The system needs to connect events, recognise a completed purchase and state exactly when inactivity counts as abandonment.

Project walkthrough

From clicks to an abandonment candidate

  1. Start with sample shopping activity

    Simulated clicks represent a shopping journey. Kafka carries them into Snowflake, where they can be organised and analysed.

  2. Group clicks into visits

    I compare each click with the previous one from the same shopper. A gap of at least 15 minutes starts a new visit, called a session. This makes separate visits easier to follow.

  3. Look for an unfinished purchase

    A visit qualifies when an item was added to the cart, no purchase was completed and at least 15 minutes have passed without activity. This is a defined rule, not certainty about the shopper’s intentions.

  4. Update the result each hour

    Clicks arrive continuously, but the calculations run once an hour. Keeping those schedules separate makes clear when the report can show a new result.

A view from the project. See the results below for more detail.

A view from the project. See the results below for more detail.

Cart Abandonment Engine

Project overview · Architecture illustration

Decision

Collect the clicks before interpreting them

Python generates sample shopping activity. Kafka carries those events and a managed connector delivers them to Snowflake. This reduces the transfer code I need to maintain and lets me focus on the SQL that groups clicks into shopping visits.

View the code ↗

Decision

Decide what counts as an unfinished purchase

The rule looks for an item added to a cart, no completed purchase and at least 15 minutes without activity. SQL also uses gaps between clicks to separate shopping visits. This gives the project a clear rule, but a shopper who pauses may still come back later.

View the code ↗

Decision

Review the activity every hour

Airflow runs the calculations hourly and retries failed runs. Only one run can be active at a time, which prevents overlapping work. The 15-minute rule describes when a cart qualifies; the hourly schedule determines when the result is updated.

View the code ↗

Governance

Make the shopping rule easy to follow.

The project spells out what counts as a shopping visit and an unfinished cart. It also separates the 15-minute inactivity rule from the hourly update schedule, so a reader knows both what the result means and when it can change.

Related governance examples

Evidence

Recorded project results

Recorded keyed Kafka events

1 / 3Recorded keyed Kafka events

Recorded keyed Kafka events

Recorded transformation run

Clickstream-to-session lineage

What to keep in mind

What the evidence establishes

This uses simulated activity and does not send customer reminders or measure recovered sales. Late clicks and events with identical times still need dedicated checks. The schedule calls dbt tests, but the repository does not yet define a substantive set of model tests.

← More projectsDiscuss this project ↗