# Recommendation events mapping

# Event Mapping for Product Recommendations

## Overview

Event Mapping allows you to map **any tracked website event** to standardized **recommendation events** used by the recommendation engine.

You can find it on integration details page, just click a tab named "Event Mapping".

This means you do not need to rename or modify your existing tracking events. Instead, you map your custom event names and attributes to the system’s required recommendation events.

Once mapped, these events power product recommendation feeds such as:

- Recently Viewed
- Recently Added to Cart
- Purchase-based recommendations

---

## How Event Mapping Works

1. Your website sends custom events (e.g., `item_seen`, `cart_add`, `remove_item`, `checkout_complete`).
2. In Event Mapping, you select which incoming event should correspond to a recommendation event.
3. You map required attributes (such as `productId`).
4. The recommendation engine uses the mapped data to power feeds and models.

You can map **any event** to a recommendation event, giving you full flexibility without changing your tracking implementation.

---

## Supported Recommendation Events

### 1. Product Viewed

Used for:
- Recently Viewed products
- View-based recommendation models

**Required attribute:**
- `productId`

---

### 2. Added to Cart

Used for:
- Recently Added to Cart feed
- Cart-based recommendation logic

**Required attribute:**
- `productId`

---

### 3. Removed from Cart

Used to maintain accuracy of the **Recently Added to Cart** recommendation feed.

When a product is removed from the cart, this event ensures:
- The product is removed from cart-based feeds
- Cart state remains consistent
- Recommendations reflect real user behavior

**Required attribute:**
- `productId`


This event is important for keeping cart-based recommendation signals clean and up to date.

---

### 4. Product Ordered

Used for:
- Purchase-based recommendation models
- Cart state tracking (purchased items are removed from cart)
- Post-purchase recommendations

**Required attribute:**
- `productId`

---

## Attribute Mapping

For each mapped event, you must connect your incoming event attributes to the required recommendation attributes.

Example:

If your event sends:

```json
{
"id": "SKU_123"
}
```

You would map:

```
id → productId
```

You can map attributes from:
- Event attributes
- User attributes
- Account attributes

This allows you to reuse your existing data structure without modifying your tracking setup.

---

## Why Use Event Mapping

Event Mapping ensures:

- No changes are required to your tracking implementation
- Recommendation feeds remain accurate
- Cart-based feeds stay consistent
- Purchase signals are correctly captured
- All recommendation models receive standardized inputs

---

## Best Practices

- Always correctly map `productId` (required for all recommendation events).
- Map **Removed from Cart** if you use cart-based recommendation feeds.
- Ensure your mapped events reflect real user behavior.
- Test event mappings after configuration to verify correct triggering.

---

Event Mapping gives you full flexibility to align your existing tracking events with recommendation system requirements — without additional engineering work.
