# Automations from Web Events

Trigger automations based on website activity

Mailnaptic automations can be triggered by **website activity**, not just email events. When a known contact performs an action on your site — viewing a page, completing a purchase, or firing a custom event — that activity can kick off an automated workflow in real time.

## Setting up a web event trigger

1. Go to **Automations** and create a new automation or edit an existing one.
2. In the trigger configuration, select **Site Event** as the trigger type.
3. Choose the **event type**:
    - **Page view** — triggers when a contact views any page (optionally filtered by URL).
    - **Custom event** — triggers when a specific named event fires (e.g., `order_completed`).
4. If you selected *Custom event*, enter the **event name** to match.
5. Build your automation flow (delay, send email, update contact, etc.) and activate the automation.

## Trigger configuration options

| Field | Description | Example |
| --- | --- | --- |
| `event_type` | The category of site event | `page` or `track` |
| `event_name` | The specific event name (required for `track` type) | `order_completed` |

## Common web event automations

### Abandoned cart recovery

Trigger on the `product_added_to_cart` event. Add a **2-hour delay**, then check whether the contact has since triggered `order_completed`. If not, send a cart recovery email with a reminder and optional discount code.

### Post-purchase follow-up

Trigger on `order_completed`. Send an immediate order confirmation, wait 7 days, then send a review request or cross-sell email based on the product category.

### High-intent page visit

Trigger on a page view matching `/pricing` or `/demo`. Wait 1 hour, then send a helpful email offering to answer questions or schedule a call. This works well for B2B SaaS products.

### Feature adoption nudge

Trigger on a custom event like `feature_activated`. Send a congratulatory email with tips for getting the most out of that feature, followed by a check-in email a few days later.

## Requirements for web event triggers

- **Site tracking must be installed** on the pages where events originate.
- The visitor must be an **identified contact**. Anonymous events cannot trigger automations because there is no contact to enroll.
- The automation must be in an **active** state. Draft or paused automations do not process triggers.

## How enrollment works

When a site event matches an active automation trigger, Mailnaptic **enqueues** the contact for that automation. The automation worker picks up the enqueued entry and begins executing the flow. If the same contact triggers the event again while already enrolled, the behavior depends on your automation's **re-entry settings**:

- **Allow re-entry:** The contact starts the flow again from the beginning.
- **No re-entry:** The duplicate trigger is ignored.

## Monitoring and troubleshooting

To verify that web events are triggering automations correctly:

1. Check the contact's **Activity** tab for the web event that should have triggered the automation.
2. Review the automation's **run history** to see if the contact was enrolled.
3. If runs are stuck in a "processing" state for more than 10 minutes, Mailnaptic's stall recovery will automatically reset them to retry.

> **Tip:** Use the pre-made *Abandoned Cart* automation template to get started quickly. It includes the trigger, delay, conditional check, and email steps pre-configured.
