In order to prompt the subscription for push notification using the custom page, you should call Pushwoosh.subscribe() method on it.
This method is used to request a user's permission for push notifications. If a user is already subscribed, the method will stop executing.
If a user hasn’t subscribed for pushes yet:
- Permission for push notifications is requested.
- If a user allows notifications,
onSubscribe
event is triggered.
By default, Pushwoosh.subscribe()
is executed automatically if autoSubscribe: true
. is set during the SDK initialization.
Call this method if you have chosen to manually prompt a user to subscribe for pushes using the autoSubscribe: false
parameter during the initialization:
<button onclick="Pushwoosh.subscribe()">Subscribe</button>
<script>
Pushwoosh.push(['onSubscribe', function(api) {
console.log('User successfully subscribed');
}]);
</script>
Please refer to our Integration Guide for more information.
Comments
0 comments
Please sign in to leave a comment.