# Triggers

### Overview

A **trigger** defines the exact moment an experience is activated for a visitor.

While targeting determines **who** should see an experience, a trigger determines **when** it should appear. It controls the timing and behavioral condition required before the experience is displayed or executed.

Triggers allow you to align your experiences with real user behavior. Instead of showing content immediately or randomly, you can wait for meaningful actions such as time spent on a page, scrolling, clicking a button, or preparing to leave. This ensures that experiences feel contextual, relevant, and less disruptive.

Using triggers effectively helps you:

* Deliver messages at the most impactful moment
* Improve engagement and conversion rates
* Avoid interrupting critical user flows
* Personalize interactions based on behavior
* Create more strategic and intentional user journeys

Each experience has its own trigger configuration, which can be managed from the **Settings** tab. Selecting the right trigger is essential for balancing visibility, timing, and user experience.

In short:

* **Targeting = Who sees it**
* **Trigger = When they see it**

Together, they give you full control over how and when your experiences are delivered.

### Where to Find Triggers

To configure triggers for an experience in CustomFit.ai, follow these steps:

1. Log in to your **CustomFit.ai Dashboard**.
2. From the left-hand sidebar, click on **Experience Engine**.
3. Select the experience in which you want to configure the trigger.
4. Navigate to the **Settings** tab within the selected experience.
5. Locate the **Trigger** section and choose the desired trigger type.
6. Configure the required trigger conditions and save your changes.

<figure><img src="/files/mNHJ9LiROiyaKb7QYSEI" alt=""><figcaption></figcaption></figure>

### Trigger Types

#### 1. Default

**Description:**\
Triggers the experience as soon as possible after the page begins loading.

**Use case:**\
Best for experiences that should appear immediately, such as announcements or mandatory messages.

**Notes:**

* Executes early in the page lifecycle.
* May display before all page elements are fully rendered.

#### 2. On Load of Page

**Description:**\
Triggers the experience when the DOM is fully loaded and ready.

**Use case:**\
Ideal when the experience depends on page elements being available in the DOM.

**Notes:**

* Waits for the page structure to be ready.
* More stable for element-dependent interactions than the Default trigger.

#### 3. On Click of an Element

**Description:**\
Triggers when the visitor clicks on a specified element.

**Configuration Required:**

* You must define the target element (e.g., CSS selector, element ID, or class).

**Use case:**

* Button clicks
* Navigation links
* Call-to-action interactions

**Example:**\
Trigger an experience when a user clicks the “Start Free Trial” button.

#### 4. Time Spent on a Page

**Description:**\
Triggers after the visitor has spent a specified amount of time on the page.

**Configuration Required:**

* Time in milliseconds (e.g., `10000` = 10 seconds)

**Use case:**

* Delayed popups
* Engagement prompts
* Timed promotions

**Example:**\
Show a subscription offer after 15 seconds on the page.

#### 5. Scroll Percentage

**Description:**\
Triggers after the visitor has scrolled a specified percentage of the page.

**Configuration Required:**

* Scroll percentage (e.g., 50%)

**Use case:**

* Content engagement prompts
* Mid-article offers
* Progressive messaging

**Example:**\
Display a related content recommendation after a visitor scrolls 70% of the article.

#### 6. Exit Intent

**Description:**\
Triggers when the visitor shows intent to leave the page.

**How it works:**\
Detects cursor movement toward the browser’s top bar or tab area (desktop devices).

**Use case:**

* Abandoned cart offers
* Last-chance promotions
* Feedback surveys

**Notes:**

* Primarily effective on desktop devices.
* May not function consistently on mobile.

#### 7. Custom

**Description:**\
Triggers based on custom conditions defined by you.

**Invocation (How to fire the trigger):**

After defining your custom logic or rule conditions, call the function below to invoke the trigger:

* **Function:** `executeTrigger();`
* **Purpose:** Executes your custom trigger logic and fires the experience when conditions are met.

```js
// Some code// ...your custom logic here

executeTrigger();
```

**Use case:**

* Complex targeting conditions
* Combined behavioral triggers
* Advanced segmentation rules

**Example: Invoke trigger after a delay**

Use `executeTrigger();` to invoke your custom trigger once your logic is ready. For example, to trigger the experience after **5 seconds**:

```js
setTimeout(function () {
  // Call this method to invoke the custom trigger
  executeTrigger();
}, 5000);

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.customfit.ai/triggers.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
