Performance tools such as Lighthouse or PageSpeed Insights may report Cumulative Layout Shift (CLS) attributed to the Pushwoosh subscription prompt. This happens when the prompt is inserted into the page while content is still settling.
If you use the Subscription widget (recommended for new integrations)
The Subscription widget replaces the custom subscription popup and the default Subscription prompt once its prompt or bell is turned on. Configure it through the subscriptionWidget object in your Web SDK init call. The relevant display parameters are:
-
trigger—'auto','launcher'or'manual'. With'launcher'the prompt opens only when the visitor clicks the bell; with'manual'it opens only when you call it from your own code, for example from a click on your own "Get notifications" button. Shifts within 500 ms of a user interaction are excluded from CLS. -
delay— seconds before the prompt appears on the'auto'trigger (0-3600). Raising it past the point where your layout has stabilised keeps the shift out of the CLS measurement window. -
cappingCountandcappingInterval— how many times, and how many hours apart, the prompt is shown automatically.
Learn more: Subscription widget
If you use the custom subscription popup (legacy Web SDK popup)
The prompt is configured through the subscribePopup object in your Pushwoosh Web SDK init call. The relevant parameters are:
-
delay— seconds between page load and the popup appearing. Raising this past the point where your layout has stabilised keeps the shift out of the CLS measurement window. -
manualToggle— set totrueto stop the popup appearing on its own, then show it yourself in response to a user action (for example, a click on your own "Get notifications" button). Shifts within 500 ms of a user interaction are excluded from CLS. -
overlay— set totrueto dim the page behind the popup with a backdrop. -
position—'top','center'or'bottom': where on the page the popup appears. -
retryOffset— seconds before the popup is shown again after "Ask later" (default 604800, one week).
Pushwoosh.push(['init', {
// ...
subscribePopup: {
enable: true,
delay: 60,
manualToggle: false,
overlay: true,
position: 'bottom'
}
}]);
Learn more: Custom subscription popup
If you use the default widget
Configure it at Settings > Configure platforms > Web push notification > Subscription prompt, then click Settings. Note that the default widget already limits itself: if a user denies or ignores it, it reappears after 4 hours and is capped at 3 total impressions. Changes to the widget can take up to 30 minutes to appear.
Trade-off: changing the trigger from automatic display to requiring a user interaction, or adding a long delay, will normally reduce the number of push subscribers you collect. Measure opt-in rate alongside your CLS score rather than optimising one in isolation.
Comments
0 comments
Please sign in to leave a comment.