Automatically pop-up the Live Chat bubble just on selected pages
If you want to automatically pop-up Live Chat bubble just on a selected set of pages - you're in the right place.
CustomGPT.aiβs Automatically pop up the chatβ―bubble option already lets the widget open itself on page load for desktop, mobile, or both.
But what if you want that attentionβgrabbing popup only on highβintent pages (e.g.,β―pricing, checkout, documentation) and not on every visit to your blog
The pageβaware deployment script below gives you that fineβgrained control in just a few lines of code.
When &β―Why to Use PageβAware AutoβPopup
Situation | Benefit |
---|---|
Conversion pages (pricing, signβup, demo request) | Draws visitors into a conversation the moment they show buying intent. |
Support articles / docs | Offers instant answers precisely where users get stuck, without nagging them elsewhere. |
Landing pages from ad campaigns | Tailors the welcome message and timing to the campaign for higher ROI. |
SEO Blog posts | Keep the chat available but silent, so content consumption isnβt interrupted. |
By limiting the popup to βhotβ pages you maximize engagement while minimizing annoyance.
How the Script Works
- List βvalidβ paths β any URL path you place in validEmbedPaths is eligible for autoβpopup.
- Pick popup mode using the same constants CustomGPT uses in the dashboard:
const AUTO_POPUP_OPTIONS = {
NONE: 0, // No auto popup
DESKTOP_ONLY: 1, // Desktop only
MOBILE_ONLY: 2, // Mobile only
BOTH: 3 // Desktop & mobile
};
- Choose behaviour
autoPopupForValidPaths
β what happens on pages in your listautoPopupForOtherPaths
β what happens everywhere else (often NONE)
StepβbyβStep Guide
- Identify the pages that should pop up (e.g.,
/pricing/
,/checkout/thankβyou.html
). - Copy the snippet and paste it instead of regular Live Chat code snippet:
<script src="https://cdn.customgpt.ai/js/chat.js" defer></script>
<script defer>
window.onload = () => {
// 1. List of paths that SHOULD autoβpopup
const validEmbedPaths = [
"/pricing/",
"/checkout/",
"/docs/getting-started/",
"/my/path/index.html"
];
// 2. Popup modes (same as dashboard)
const AUTO_POPUP_OPTIONS = { NONE:0, DESKTOP_ONLY:1, MOBILE_ONLY:2, BOTH:3 };
// 3. Configure behaviour
const autoPopupForValidPaths = AUTO_POPUP_OPTIONS.BOTH; // change if needed
const autoPopupForOtherPaths = AUTO_POPUP_OPTIONS.NONE; // stay silent elsewhere
// 4. Decide what to do for THIS page
const isValidPath = validEmbedPaths.includes(window.location.pathname);
const autoPopupChoice = isValidPath ? autoPopupForValidPaths : autoPopupForOtherPaths;
// 5. Initialise the Live Chat
CustomGPT.init({
p_id : "AGENT_ID", // β replace
p_key: "AGENT_KEY", // β replace
autoPopUp : autoPopupChoice,
args_priority: true // keeps URL param overrides if you use them
});
};
</script>
- Replace placeholders
AGENT_ID
β your agent IDAGENT_KEY
β your agent key
Tips & Variations
- Wildcards / startsβwith β For sections rather than exact paths, swap the equality check:
const isValidPath = window.location.pathname.startsWith("/docs/")
; - Singleβpage apps (SPA) β Reβrun CustomGPT.init() whenever your router changes the path.
- Performance β All logic runs after window.onload; total overhead is a few milliseconds.
Updated 3 days ago