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

SituationBenefit
Conversion pages (pricing, sign‑up, demo request)Draws visitors into a conversation the moment they show buying intent.
Support articles / docsOffers instant answers precisely where users get stuck, without nagging them elsewhere.
Landing pages from ad campaignsTailors the welcome message and timing to the campaign for higher ROI.
SEO Blog postsKeep 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

  1. List β€œvalid” paths – any URL path you place in validEmbedPaths is eligible for auto‑popup.
  2. 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
};
  1. Choose behaviour
    1. autoPopupForValidPaths β†’ what happens on pages in your list
    2. autoPopupForOtherPaths β†’ what happens everywhere else (often NONE)

Step‑by‑Step Guide

  1. Identify the pages that should pop up (e.g., /pricing/, /checkout/thank‑you.html).
  2. 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>
  1. Replace placeholders
    1. AGENT_ID β†’ your agent ID
    2. AGENT_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.