Use this when the built-in triggers can't express the moment — for example "after the visitor adds a third item to the cart". You need the tracking script on the page and a published popup.
Open the popup
entailInsights.showPopup('POPUP_ID');Argument | Type | What it is |
|---|---|---|
| string | Required. The ID of a published popup — see Find the popup ID . |
The popup opens at once. Its triggers, frequency and pages and devices don't apply: you decide when, where and how often. If another popup is already open, nothing happens.
A popup only for your code. Leave the popup's trigger unset — the Display tab reads choose when — so it never opens by itself, then publish it and open it with showPopup.
Find the popup ID
The ID is part of the popup's code snippet in the classic builder:
- Publish the popup, if it isn't yet.
- In the widget builder, open More actions and choose Open in Classic Builder, then confirm with Open Classic Builder.
- Click Copy Code Snippet at the bottom. It copies a line like the one below.
- The ID is the value of
entail-widget-id. Close the classic builder without saving.
<div class="entail-ai-widget-6512ab34cd56ef7890123456" entail-widget-id="6512ab34cd56ef7890123456"></div>Here the ID is 6512ab34cd56ef7890123456. Use that value — not the ID in the builder's web address, which is a different one.
Don't paste the snippet on your page. That line is for widgets that sit inside a page. A popup needs only the ID; pasting the line doesn't open it.
Wait until CROforce has loaded
The snippet in your page head creates entailInsights straight away, but showPopup only exists once the CROforce script has finished loading. A call from a click handler is almost always late enough. For code that runs as the page opens, check first, or use the init option loaded:
Check first
function openCroforcePopup(id) {
if (window.entailInsights && typeof window.entailInsights.showPopup === 'function') {
window.entailInsights.showPopup(id);
}
}loaded option
entailInsights.init('YOUR_SITE_TOKEN', {
disable_decide: false,
loaded: function (sdk) {
// Runs once CROforce is ready.
if (window.location.hash === '#offer') sdk.showPopup('POPUP_ID');
},
});The loaded version edits the init line of your existing snippet — keep your own site token and any options already there.
Examples
Your own button
document.querySelector('#talk-to-sales').addEventListener('click', function () {
entailInsights.showPopup('POPUP_ID');
});After your code decides
function onCartUpdated(cart) {
if (cart.items.length >= 3 && typeof entailInsights.showPopup === 'function') {
entailInsights.showPopup('POPUP_ID');
}
}React
export function TalkToSalesButton() {
return (
<button onClick={() => window.entailInsights?.showPopup?.('POPUP_ID')}>
Talk to sales
</button>
);
}For a button that exists when the page loads, the no-code When they click something trigger does the same job — see When a popup shows.
If the popup doesn't open
What you see | What to do |
|---|---|
| The call ran before CROforce loaded. Check first or use |
Nothing happens, no error | Check the ID is the |
The old version opens | You changed the popup but didn't click Publish Changes. |
More help: Troubleshooting.
Next steps
- Track custom events: Send your own events from code.
- Init options: Everything you can pass to init.
- Create a popup: From template to live popup.
Frequently asked questions
Do the popup's triggers, pages and frequency still apply?
No. showPopup opens the popup straight away, on any page and device, every time you call it. Only one rule stays: if another popup is already open, it doesn't open.
Does the popup have to be published?
Yes. Visitors can only see published popups. Publish it first, then use its ID.
Can I open a popup from a button without code?
Yes, if the button is inside another popup or widget. In the widget builder, set the button's When clicked action to Open another popup and pick the popup to open.
