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
Set Opt-in to "No Prompt" in your PushOwl dashboard
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
});
});
}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" },
});
}