Skip to main content

Enabling Push notification prompt (Opt-in) manually in your store

Nayan Kulshreshtha avatar
Written by Nayan Kulshreshtha
Updated this week

Sometimes you may want to enable push notification prompt (Opt-in) in your website only on few pages based on URL if that is the case our support team can help with that but if your prompt needs to be shown based on complex condition or if you want to call prompt manually using javascript you can do the following

By default, the push notification opt-in prompt will appear on all pages of your store's website, ensuring maximum visibility to help increase subscription rates. This universal setting is designed to prompt only users who have not yet subscribed; once a user opts in, they won’t see the prompt again to provide a seamless browsing experience. Configuration options within the PushOwl dashboard also allow you to selectively show or exclude the prompt on specific URLs, making it easier to tailor the user experience to your needs.

  1. Set Opt-in to "No Prompt" in your PushOwl dashboard

  2. Then use the following Javascript code to call the prompt manually

    if (Notification.permission === "default") {
    window.pushowl = window.pushowl || [];
    window.pushowl.push(() => {
    window.pushowl.showBrowserPrompt({
    overlay: { enabled: false }
    })
    .then(() => {
    // Do anything you want after showing the prompt
    });
    });
    }

  3. If you want to call a custom prompt manually you can use the following code instead

    if (Notification.permission === "default") {
    window.pushowl.showCustomPrompt({
    title: "Lets get you offers!",
    description: "Subscribe to get amazing offers",
    yesButton: { label: "Subscribe" },
    noButton: { label: "Later" },
    logo: "image url here",
    position: { default: "top-left", mobile: "bottom" },
    overlay: { enabled: false },
    theme: { yesButtonColor: "white", yesButtonBgColor: "black" },
    });
    }
Did this answer your question?