# Built-In Events

The following events are automatically fired by Critical Moments, and can be used for triggers or conditions.

[Watching events](https://docs.criticalmoments.io/event-overview#watching-events) in debug mode can help you vizualize all the built-in events as they fire.

### App Lifecycle Events

* `app_start`: fired immediatly after the SDK starts. There may be a small delay while we fetch the latest config over the network.
* `session_start`: fired when a user session starts. This is both when the app is initially launced, and if the app enters the foreground after 10 mintues or more in the background. &#x20;
* `app_entered_foreground`: fired when the app enters the forground, including the initial launch
* `app_entered_background`: fired when the app enters the background
* `app_terminated`: fired right before the app is terminated (evicted from memory). Note: the OS will not fire this event in some cases including if the user manually closes the app, or if the app was suspended prior to termination.&#x20;

### Feature Flag Events

* `ff_true:[condition_name]`: Fired when a feature flag is evaluated with [checkNamedCondition](https://docs.criticalmoments.io/feature-flags) and returns true. Latter half of the string is the condition name which was evaluated.
* `ff_false:[condition_name]`: Fired when a feature flag is evaluated with [checkNamedCondition](https://docs.criticalmoments.io/feature-flags) and returns true. Latter half of the string is the condition name which was evaluated.
* `ff_error:[condition_name]`: Fired when a feature flag is evaluated with [checkNamedCondition](https://docs.criticalmoments.io/feature-flags) and returns true. Latter half of the string is the condition name which was evaluated.

### Action Events

* `action:[action_name]`: Fired when a named action is performed. For example, if you fired an action named `gdpr_banner`, the event log would have an event for `action:gdpr_banner`
* `action_error:[action_name]`: Fired when we attempt to perform a named action, but there is an error.

#### App Review Action

* `system_app_review_requested`: fired when any [app review action](https://docs.criticalmoments.io/actions-in-app-messaging/app-reviews) is fired.&#x20;

#### Banner Actions

* `sub-action:[action_name]:tapped`: fired when a banner is tapped.
* `sub-action:[action_name]:closed`: fired when a banner is closed.

#### Alert Actions

* `sub-action:[action_name]:button:[button_label]`: fired when a button is tapped on an alert. The button\_label is the string label of the button. The "OK" and "Cancel" strings are not localized in events, unlike UI, so the database is consistent across locales.
* `sub-action:[action_name]:button_index:[button_index]`: fired when a button is tapped on an alert. The button\_index is the index of the button tapped. The custom button array starts at index 0, the OK button has a constant value -1, and the Cancel button has a constant value -2.

#### Modal Actions

* `sub-action:[action_name]:closed`: fired when a modal is closed.
* `sub-action:[action_name]:button:[button_label]`: fired when a button is tapped on an modal. The button\_label is the string label of the button.
* `sub-action:[action_name]:button_index:[button_index]`: fired when a button is tapped on an modal. The button\_index is the index of the button tapped. Not fired for the "close" button (see the `closed` event above).

### Notification Events

* `notifications:tapped:[notification_id]`: fired when a notification is tapped. The notification id is the [UNNotificationRequest identifier](https://developer.apple.com/documentation/usernotifications/unnotificationrequest/identifier) of the notification. For notifications created in Critical Moments the ID format is `io.criticalmoments.notifications.[notification_name]`.&#x20;
