---
title: Alerting with rules
slug: analytics/docs/alerting-with-rules
docTags: 
createdAt: 2026-07-20T15:44:51.074Z
---

In Optimizely Analytics, rules describe the criteria needed to trigger an alert. Alerts can be of any of the following severities – info, a warning, a critical message, or custom alerts for additional categories. You can set different criteria for each of these categories.

Rules is not available by default. If you want to enable this optional feature in Analytics, contact [support@netspring.io](mailto\:support@netspring.io).

This section helps you define simple rules and alerts. You should be familiar with the following two concepts before creating a rule:

- **Condition states** – The state **OK** means the data point does not conform to any provided condition. Otherwise, it has that condition's state.
- **Alert generation policy** – Any data point that is not **OK** can trigger an alert. This can be noisy, as contiguous bad states often indicate the same problem, or some outliers may cause false positives. You can configure when an alert should be triggered and finalized to avoid many alerts.

## Enable rules and set the execution time[​](https://app.netspring.io/documentation/docs/Configuring%20Rules/alert_with_rules#enabling-rules-for-your-application-and-setting-execution-time)

Before creating rules, you must enable the feature.

1. Click **Settings** > **General Settings** on the navigation panel and enable **Rules**.
2. Set the **Refresh Cron Schedule**. Rules are executed periodically based on the provided cron expression. Executions must have a period of one hour or more.

   ![opti-alerts-1.gif](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/S75a2OPdfA5Hj4DbJsw2o-20260720-145000.gif)

## Create a rule[​](https://app.netspring.io/documentation/docs/Configuring%20Rules/alert_with_rules#creating-a-rule)

Users can create rules to trigger alerts when **Rules** are enabled.

![opti-alerts-2.gif](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/EmdX6f-rMo_i6PzVhV-fn-20260720-145000.gif)

To create a rule in Analytics:

1. Click **+** > **Rule** on the navigation panel.
2. Configure the rule under the **Rule Definition** tab.
3. Choose a metric – for example, **Total Time Viewed(TTV)**.
4. Specify the thresholds to flag alerts. For example, set two conditions: a **critical** alert when the **Total Time Viewed(TTV)** is \_less than or equal to *48000* and a **warning** when the **Total Time Viewed(TTV)** is less than or equal to *55000*. Choose different colors to differentiate each category of alert.
5. Configure the **Final Bound** for the alerts so that when the value goes beyond a particular threshold, it is considered an OK state, meaning no alerts are triggered. In the example, set the configuration to reach the final bound when the **Total Time Viewed(TTV)** is less than or equal to *40000*. You can add as many conditions as necessary and choose a color for each category of alerts configured.
6. Click **Alert Generation Policy,** and it displays the following fields:
   - **Generate for states** – Define the states to generate alerts. Here, it is set to **not in** **ok** state.
   - **Open alert after** – Configure when to trigger an alert. Here, it is set to **1 consecutive non-OK state**.
   - **Finalize for states** – Define the states indicating the alert is over. Typically, **OK** states indicate the finalization of alerts, but it can be any custom label defined previously. Here, it is set to **in ok** state.
   - **Finalize alert after** – Configure when you want the alert to be over. Here, it is set to **5 consecutive OK states**.

     ![opti-alerts-4.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/CE8fixF9AxasayUt-gHUG-20260720-145000.png)
7. Add **Grouping Dimensions** to add more grain to the alert configuration. You can add filters to rules using the **Add Filter** option.

   ![opti-alerts-3.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/8ruxOkYA3x-HGRAm0x2Uq-20260720-145000.png)
8. Click **Run** to see a simulated output of the rule—a graph of the metric displays over the specified time range. In addition, you can preview the alerts that would be triggered.

   ![opti-alerts-5.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/nv9JzNC5cS-hVTrcJZdaz-20260720-145000.png)
9. Create alerts for every data point satisfying one of the provided conditions instead of combining consecutive alerts by setting the **Finalize alert after** field to **zero consecutive OK states** (the default is 1, which means it waits for an OK state to finalize an alert).

   ![opti-alerts-6.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/mVA9J8NneNktS9UHLUlBy-20260720-145000.png)
10. Save the rule, which you can turn on or off using the toggle.

    ![opti-alerts-7.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/jxTpJkO34_neRxnO_C8W2-20260720-145000.png)

## Alert Template[​](https://app.netspring.io/documentation/docs/Configuring%20Rules/alert_with_rules#alert-template)

You can customize the content reported in the alert and the push notification. The **Alert Template** page helps specify important details in the title and description. Add custom fields to the alert to tailor it to your business needs or link to dashboards or URLs.

The **Alert Template** page shows the following:

- Alert customization options
- A preview of the push notification on the phone

The **Alert Template** page lets users control the text in the alert's details. You can include three types of information in the alert's title or description:

- **%Property** – Add any pre-defined metadata about the alert, such as the alert's rule name or status.
- **Line Break** – Add line breaks to format the information.
- **Text** – Add your own hardcoded strings.

To customize an alert:

1. Go to the **Alert Template** tab inside **Rules**.
2. Configure the **Title** of the alert. The title is displayed on the alert details page and also in notifications. You can choose the elements you want to add from the drop-down list. *Line Break*, *Property*, and *Text* are the options that are currently available.
3. Add a description for the alert.
4. Link alerts to dashboards or custom URLs to add more context to the issue.

   ![opti-alerts-8.gif](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/8KvNw_LG_rmFVRyyre48E-20260720-145000.gif)

## Other Actions[​](https://app.netspring.io/documentation/docs/Configuring%20Rules/alert_with_rules#other-actions)

### Share a rule[​](https://app.netspring.io/documentation/docs/Configuring%20Rules/alert_with_rules#sharing-a-rule)

1. Click **Share**.
2. Enter the names of the users or groups with whom you want to share the rule and specify the access levels for each user.
3. Click **Invite**.

   ![opti-alerts-9.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/nsxiMPhGI84Rsc7vp2UW4-20260720-145000.png)

### Duplicate a rule[​](https://app.netspring.io/documentation/docs/Configuring%20Rules/alert_with_rules#duplicating-a-rule)

1. Click **More** > **Save As**.
2. Add a name and description for the duplicate, choose a folder, and click **OK**.

   ![opti-alerts-10.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/5zAyADOtKwJetRWj82Uwz-20260720-145000.png)

### Delete a rule[​](https://app.netspring.io/documentation/docs/Configuring%20Rules/alert_with_rules#deleting-a-rule)

1. Click **More** > **Delete**.
2. Click **Delete** in the dialog to confirm the deletion.

   ![opti-alerts-11.png](https://api.archbee.com/api/optimize/BrbvVORKJ5iIeSMZye5kI/I68vnwoY3mtPdW89Yi-O5-20260720-145001.png)
