# Fire Event

{% embed url="<https://www.youtube.com/watch?v=lXRFnk4j-kc>" %}

Watch this on Youtube: <https://www.youtube.com/watch?v=lXRFnk4j-kc>

The **Fire Event** action triggers custom analytics events within your app. These events can be used for tracking user interactions, measuring feature usage, triggering workflows, or communicating with external analytics services.

***

#### 📦 Properties

| Property | Type  | Required | Description                                                 |
| -------- | ----- | -------- | ----------------------------------------------------------- |
| `events` | Array | ✅        | List of events to fire, each with name and optional payload |

***

#### ✅ Common Use Cases

* Tracking user interactions and feature usage
* Measuring conversion funnels and user journeys
* Triggering custom workflows based on user actions
* Sending data to external analytics platforms
* Implementing event-driven architectures
* A/B testing and feature flag implementations

***

#### ⚙️ Default Behavior

By default:

| Behavior                  | Description                                                   |
| ------------------------- | ------------------------------------------------------------- |
| **Event Processing**      | All events in the array are fired sequentially                |
| **Analytics Integration** | Events are sent to configured analytics handlers              |
| **Payload Evaluation**    | Event payloads are processed as-is (no expression evaluation) |
| **Error Handling**        | Continues processing remaining events if one fails            |

***

#### 🛠️ How to Use

<figure><img src="https://3626461507-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FbhApDTL7kHrXte2TTtjs%2Fuploads%2Fgit-blob-8e194af4cf1c274627dad10092b54a8632595456%2Ffire_event_action.png?alt=media" alt="Call External Method action configuration showing message name and payload fields"><figcaption><p>Call External Method action configuration in Digia Studio</p></figcaption></figure>

1. Add the action to a widget event (e.g., button tap, form submission)
2. Choose **Fire Event** from the action list
3. Add events to the `events` array with names and optional payloads

**Event Name (`name`):**

* **Required field** that identifies the type of event
* Should be descriptive and follow consistent naming conventions
* Examples: `"button_clicked"`, `"form_submitted"`, `"feature_used"`
* Used by analytics systems to categorize and track events

**Event Payload (`payload`):**

* **Optional field** containing additional data about the event as a JSON object
* Can include any relevant information (strings, numbers, booleans, arrays, nested objects)
* Supports dynamic values using expressions (e.g., `appState.currentUser`)
* Used for detailed event analysis and segmentation

***

#### 📊 Event Structure

Each event in the `events` array has the following structure:

```javascript
{
  "name": "event_name",        // Required: Event identifier
  "payload": {                 // Optional: Additional data
    "key1": "value1",
    "key2": 123,
    "key3": true
  }
}
```

***

{% embed url="<https://digiaacademy.portal.trainn.co/share/fire-event-examples>" %}
