# Event Setup

With your **Pixel ID** and **Conversion API** activated, the next step is to define the **events** that JENTIS should send to Facebook. Events describe what happened on your website (e.g., a purchase, a form submission, or a page view).

### 1. Align Events with Business Goals

Before configuring anything in JENTIS:

* Review your **business requirements**.
* Decide **which visitor interactions** should be tracked (e.g., `Purchase`, `Lead`, `AddToCart`).
* Ensure that legal aspects (e.g., handling PII) are considered.

### 2. Define Events in Facebook Business Manager

1. Go to [Facebook Business Manager](https://business.facebook.com/) → **Events Manager**.
2. Select your **Pixel ID**.
3. In the **Events Setup**, choose which events to configure:
   * Standard events (e.g., `Purchase`, `Lead`, `PageView`)
   * Custom events (e.g., `NewsletterSignup`)

### 3. Configure Event Parameters

Each event requires **parameters** to provide additional context:

* **Standard Parameters** (handled automatically by JENTIS if activated):
  * `external_id` (internal user reference)
  * `fbc` (Facebook Click ID cookie)
  * `fbp` (Facebook Browser ID cookie)
* **Optional Parameters** (depending on business needs):
  * `email` (must be **hashed**)
  * `phone` (hashed)
  * `ip_address`, `user_agent`
  * product details (e.g., `value`, `currency`, `content_ids`)

Example configuration in Events Manager:

```
Event: Purchase
Parameters: value, currency, external_id, fbc, fbp, email
```

### 4. Handling Personally Identifiable Information (PII)

* Facebook requires **PII values** (e.g., email, phone) to be **hashed** before submission.
* JENTIS will forward them as provided.
* Always hash data client-side before pushing it to JENTIS.

Example (pseudo-code, **do not run**):

```js
var emh = sha256("mail@address.com");

_jts.push({
  "track": "event",
  "group": "fbpii",
  "name": "purchase",
  "emh": emh
});
```

### 5. Confirm in Facebook

After configuring events:

* Facebook Events Manager will display each event.
* Ensure parameters are received and mapped correctly.
* Use the **Test Event Code** for real-time debugging before going live.

{% hint style="success" %}
Now your events and parameters are defined in Facebook.
{% endhint %}
