> For the complete documentation index, see [llms.txt](https://help.recart.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.recart.com/list-growth/opt-in-tools-external-triggers.md).

# Opt-in Tools - External Triggers

**Table of Contents**

* [What Are External Triggers?](#what-are-external-triggers)
* [How External Triggers Work](#how-external-triggers-work)
* [Finding Your Code Snippet](#finding-code-snippet)
* [Force Display Option](#force-display)
* [A/B Testing with External Triggers](#ab-testing)
* [Troubleshooting](#Troubleshooting)

### Using External Triggers with Recart Popups

External triggers allow you to control when your Recart popups appear using your own custom code or third-party applications. Instead of relying on Recart's standard display rules, you can programmatically trigger popups based on your specific business logic.

#### What Are External Triggers?

External triggers give you programmatic control over popup display timing through JavaScript. This is useful when you want to integrate popup displays with other actions on your site, such as:

* Showing a popup after a specific user action
* Triggering popups based on custom conditions you've defined
* Integrating popup displays with third-party tools
* Creating complex display logic beyond standard trigger options

#### How External Triggers Work

When you use an external trigger, Recart still applies your popup's device, geo-targeting, and URL targeting settings. However, the timing of when the popup appears is controlled entirely by your code.

External triggers will:

* Respect device filtering (mobile/desktop)
* Apply geo-targeting rules from your popup Settings
* Apply URL targeting from your popup Settings
* Follow configuration rules for SMS popups

External triggers will not:

* Ignore successful subscription (the popup will display even if a visitor has previously closed it)

#### Finding Your Code Snippet

When you select "External Trigger" as your trigger type in the popup editor, Recart automatically displays the code snippet you need. This snippet includes your specific popup ID.

**Basic implementation:**

```
window._recart.showOptinTool("YOUR_POPUP_ID")
```

Simply copy this code and implement it wherever you want the popup to trigger on your site.

#### Force Display Option

For advanced use cases where you need a popup to display even when another popup is already active (open or minimized), you can add a force parameter:

```
window._recart.showOptinTool("YOUR_POPUP_ID", { force: true })
```

This is primarily useful when displaying a secondary popup after a visitor interacts with your first popup.

**Note:** Use the force option carefully, as showing popups too aggressively may negatively impact customer experience.

#### A/B Testing with External Triggers

If you're running A/B tests with externally triggered popups, Recart provides a method to retrieve which popup variant should be displayed:

```
const activePopupId = window._recart.getActiveOptinToolInExperiment(EXPERIMENT_ID)
window._recart.showOptinTool(activePopupId)
```

This code snippet is also shown in the popup editor when you add A/B testing to an externally triggered popup.

#### Troubleshooting

If your external trigger isn't working as expected, check the following:

1. **Popup ID:** Ensure the popup ID in your code matches your actual popup ID
2. **Popup Status:** Verify your popup is published and active
3. **Targeting Settings:** Confirm your device, geo, and URL targeting settings allow the popup to display in your test scenario
4. **Script Loading:** Make sure your trigger code runs after the Recart script has loaded
5. **Console Errors:** Check your browser's developer console for JavaScript errors

#### Need Help?

External triggers offer powerful customization options. If you have questions about implementing external triggers or need assistance with your specific use case, please contact our support team through the chat widget or by emailing <support@recart.com>.

***


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.recart.com/list-growth/opt-in-tools-external-triggers.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
