All Collections
Subscribers & Opt-Ins
Subscribers
Enabling Push notification prompt (Opt-in) manually in your store
Enabling Push notification prompt (Opt-in) manually in your store
Rojen avatar
Written by Rojen
Updated over a week ago

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

  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?