> For the complete documentation index, see [llms.txt](https://docs.elevateab.com/elevate-helpcenter/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.elevateab.com/elevate-helpcenter/experiment-setup/custom-events/use-custom-events-as-triggers.md).

# Use Custom Events as Triggers

Use a custom event as a trigger in Elevate A/B Testing, so only visitors who take a specific action, like a click, enter the experiment.

***

A custom trigger enrolls a visitor into an experiment only after they perform a specific action, such as visiting a chosen product, clicking a button, or scrolling to a section. Visitors who never perform the action do not see your variations and are not counted in the results.

Custom triggers use the same custom events as goals and custom metrics. Any event stored in **Custom Events** can be a trigger.

***

### When should you use a custom trigger?

Use a custom trigger when your change only matters to visitors who reach a certain point. Counting everyone else dilutes the result with visitors who never had a chance to see the change.

| Your experiment changes                | Trigger on                                                  |
| -------------------------------------- | ----------------------------------------------------------- |
| The size guide on one product          | **Product page visits** for that product                    |
| A bundle offer shown after add to cart | **Clicks** on the add to cart button                        |
| A section far down a long product page | **Element viewed** for that section, or **Scroll depth**    |
| The flow after a product finder        | **Custom JavaScript event** fired when the finder completes |

If the change is visible to every visitor on the page where the experiment runs, you do not need a trigger.

### How is a custom trigger different from audience targeting?

|            | Audience targeting                                                                                    | Custom trigger                          |
| ---------- | ----------------------------------------------------------------------------------------------------- | --------------------------------------- |
| Filters by | Who the visitor is or where they came from: device, new or returning, UTM parameters, source, country | What the visitor does on your store     |
| Decided    | When the visitor arrives                                                                              | When the visitor performs the action    |
| Set in     | **Audiences** step, **Audience Targeting**                                                            | **Audiences** step, **Custom Triggers** |

### How do I add a custom trigger to an experiment?

1. In the experiment's **Audiences** step, scroll below **Audience Targeting** and turn on **Custom Triggers**.
2. Under **Custom events**, select the event that should enroll visitors. You can select one event.
3. To use an event you have not created yet, select **Add new custom event**, create it, and select it.
4. Select **Continue**.

Before launching, perform the trigger action on your storefront and confirm the event fires. In **Custom Events**, select refresh and check that **24 Hours Count** went up.

### What should you expect from a triggered experiment?

**Fewer visitors.** Only visitors who perform the action are enrolled, so visitor counts are lower than an untriggered experiment on the same page.

**More time to reach significance.** Fewer visitors means it takes longer to collect enough data. Choose a trigger that enough visitors perform, and plan for a longer run.

**Cleaner results.** Every enrolled visitor had the chance to see the change, so the difference between variations is not watered down by visitors who never reached it.

### What can go wrong?

| Problem                                 | Why it happens                                                           | What to do                                                                                                                                                                                           |
| --------------------------------------- | ------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| No visitors enter the experiment        | The trigger event does not fire                                          | Check the event's **24 Hours Count** and fix it. See [Troubleshooting Custom Events](https://docs.elevateab.com/elevate-helpcenter/experiment-setup/custom-events/troubleshooting-custom-events.md). |
| Very few visitors enter                 | The action is uncommon                                                   | Choose a broader trigger, or drop the trigger and track the event as a custom metric instead                                                                                                         |
| Results change after you edit the event | Editing a trigger event changes who enters every experiment that uses it | Avoid editing a trigger event while an experiment that uses it is running                                                                                                                            |

### Next steps

* [Create a Custom Event](https://docs.elevateab.com/elevate-helpcenter/experiment-setup/custom-events/create-a-custom-event.md) to set up a trigger event
* [Use Custom Events as Goals and Metrics](https://docs.elevateab.com/elevate-helpcenter/experiment-setup/custom-events/use-custom-events-as-goals-and-metrics.md) to measure the action instead of filtering on it
* [Audience Targeting](https://docs.elevateab.com/elevate-helpcenter/experiment-setup/audience-targeting.md) to filter visitors by device, source, or country
* [Custom Events](https://docs.elevateab.com/elevate-helpcenter/experiment-setup/custom-events.md) for an overview of event types and where to use them
