Personyze Wiki Personyze Wiki docs
Open Personyze
Web Push Campaigns

Web Push Subscription (Opt-In Prompt)

Set up the web push subscribe prompt — design the opt-in widget, install the service worker, and grow a subscriber list you can segment.

Updated 7 hours ago 3 min read
A
by Admin

What This Does

Before you can send a single web push notification, people have to opt in. The Web Push Subscribe campaign builds that opt-in prompt — the banner or popup that asks permission — and hands the resulting subscribers to Personyze, segmented and ready to target.

This is step one of two. Once you have subscribers, Send Web Push covers composing and sending the notifications.

Why the Prompt Matters

Browsers only let you ask for notification permission once in a meaningful way. If someone clicks “Block”, that’s effectively permanent — you cannot ask again, and recovering that user requires them to change a browser setting they will never find.

This is why a custom prompt is worth the effort. A soft opt-in of your own design lets you ask “would you like updates?” first, and only trigger the real browser permission dialog for people who say yes. Those who decline your prompt can be asked again later; those who decline the browser’s cannot.

Setting It Up

  1. Open the Web Push tab in your Personyze dashboard and select the Web Push Subscribe campaign.
  2. Choose or create a template — a pre-built notification banner or popup, or a custom design.
  3. Customize the widget:
    • Banner settings — placement and animation.
    • Text content — headline and description. Say what the notifications are for (“order updates”, “new arrivals”) rather than just asking for permission.
    • Primary button — the opt-in, e.g. “Enable Notifications”.
    • Secondary button — a soft decline, e.g. “Maybe Later”, which leaves the door open.
    • Close button — lets users dismiss it entirely.
    • Advanced HTML editing if you need finer control.
  4. Place the widget — in a placeholder, or as a popup.
  5. Set up the service worker (see below).
  6. Click Done Editing to save and activate.

The Service Worker

Web push requires a service worker file on your site — a small script the browser runs in the background to receive notifications. If your site doesn’t already have one, download Personyze’s default sw.js and place it in the root directory of your site.

It has to be at the root. A service worker can only control pages at or below its own path, so /sw.js covers your whole site while /assets/sw.js covers almost nothing. If subscriptions aren’t registering, this is the first thing to check.

When to Show the Prompt

Triggering the prompt on first page load, before a visitor knows what your site is, produces the worst opt-in rates and burns the one chance you get. Better triggers:

  • after a few page views, or a certain time on site;
  • on exit intent;
  • after a meaningful action — adding to cart, finishing an article;
  • on pages where updates are obviously useful — an out-of-stock product, an event page.

Timing and frequency use the same trigger and frequency-cap controls as any other Personyze action.

Targeting Who Gets Asked

The prompt is a normal campaign, so you can target it: ask returning visitors but not first-timers, ask logged-in customers only, or exclude regions where you don’t want to prompt. See Targeting Rules in Personyze.

Next Step

Once subscribers are accumulating, move on to Send Web Push — composing, segmenting, and sending notifications, either as a broadcast or triggered by behavior.

Related