# Onsite Events

Onsite Events are Events created when a Customer interacts with your website or online store. You can add a script to your website to capture these Events in CrossEngage automatically. For more information, please see [Web Tracking](https://documentation.crossengage.io/data-and-engagement-platform/web-tracking).

### Events

We can roughly divide Onsite events into 4 categories:&#x20;

* UserID Events
* View Events
* Product Events
* Coupon Event

Note that Orders placed on your website are considered Transactions.

{% tabs %}
{% tab title="UserID Events" %}

* User Login
* User Logout
* Identified
* Registered
  {% endtab %}

{% tab title="View Events" %}

* Viewed Page
* Viewed Cart
* Viewed Product
  {% endtab %}

{% tab title="Product Events" %}

* Added Product
* Removed Product
* Reviewed Product
* Filtered Product
* Wishlisted Product
* Wishlist removed Product
  {% endtab %}

{% tab title="Coupon Events" %}

* Coupon Entered
* Coupon Applied
* Coupon Denied
* Changed Checkout Status
  {% endtab %}
  {% endtabs %}

### Properties

All Onsite Events have two base properties: User\_id and timestamp. Additionally, based on the Event, it could also have **Cart**, **Product** and **Page** Properties.

<table><thead><tr><th>Property</th><th>Description</th><th data-type="checkbox">Mandatory</th><th>Example</th></tr></thead><tbody><tr><td>User_id</td><td>Unique identifier</td><td>true</td><td>ABC12345</td></tr><tr><td>timestamp</td><td>Event date / time</td><td>true</td><td>2022-01-01</td></tr></tbody></table>

{% hint style="info" %}
While the two base properties are common, events may or may not posses Cart, Product and page properties. If you need any help regarding events and properties, please [write us a ticket](https://documentation.crossengage.io/data-and-engagement-platform/help-and-support/reach-out-to-customer-support).
{% endhint %}

#### Cart Properties

| Property            | Description                           |
| ------------------- | ------------------------------------- |
| total               | Total value of the cart               |
| currency            | Currency                              |
| products            | products present in the cart          |
| numberOfItems       | total number of all items in the cart |
| numberOfUniqueItems | number of unique items in the cart    |

#### Page Properties

| Property | Description                                     |
| -------- | ----------------------------------------------- |
| url      | URL of the webpage                              |
| title    | Title of the webpage                            |
| path     | path to the visited page                        |
| referrer | The webpage from which this resource is visited |
| language | Language of the webpage                         |
| location | URL of the page                                 |

#### Product Properties

| Property | Description                                          |
| -------- | ---------------------------------------------------- |
| category | Product category                                     |
| brand    | Product brand                                        |
| sku      | Stock Keeping Unit, unique identifier of the product |
| name     | Product name                                         |
| currency | Currency of payment                                  |
| price    | Price per unit                                       |
| quantity | Quantity                                             |
| id       |                                                      |

### Examples

You can upload these events using the CrossEngage API, or via the Event Feed. Please go to [Data Management ](https://documentation.crossengage.io/data-and-engagement-platform/data-management)to learn more.

Here is an example of the JSON used to upload an event via the API.

```javascript
{
   "id": "78ad0e3e-19e6-4ec1-84a7-b2c860c05387",
   "timestamp": "2021-10-22T09:21:06Z",
   "events": [{
           "event": "Added Product",
           "properties": {
               "cart": {
                   "total": 150,
                   "currency": "EUR",
                   "numberOfItems": 3,
                   "numberOfUniqueItems": 1,
                   "products": [{
                           "id": "507f1f77bcf86cd879439023",
                           "sku": "61979589",
                           "brand": "Happy",
                           "title": "Zegna Shirt",
                           "name": "Striped Shirt",
                           "price": 50,
                           "quantity": 3,
                           "category": "Shirts",
                           "currency": "EUR"
 }]}}}]}
```

Here is the same example, presented as a JSON file that can be uploaded via Data Feeds:

```javascript
[{
       "event": "Added Product",
       "id": "78ad0e3e-19e6-4ec1-84a7-b2c860c05387",
       "timestamp": "2021-10-22T09:21:06Z",
       "cart": {
           "total": 150,
           "currency": "EUR",
           "numberOfItems": 3,
           "numberOfUniqueItems": 1,
           "products": {
                   "id": "507f1f77bcf86cd879439023",
                   "sku": "61979589",
                   "brand": "Happy",
                   "title": "Zegna Shirt",
                   "name": "Striped Shirt",
                   "price": 50,
                   "quantity": 3,
                   "category": "Shirts",
                   "currency": "EUR"
}}}]
```
