In Webpushify, you can send a web push notifications to all subscribers or to only a few. Webpushify offers different ways to filter notifications so that you can target specific subscribers or segments.
Webpushify offers mainly two ways to segment your subscribers: tags and user id.
Tags are mainly for marketing campaigns and to track user features, while user ids are best for personalized transactional messages.
You can manage tags in order to target specific segments of their audience. These tags can be created on the fly, and can target any number of device's subscriptions.
Through the use of tags, you can have overlapping segments, or segments generated dynamically. For instance, you can track the browsers that visit a page or perform an action on your website (leave your shopping carts), in order to target them later.
Tags let the subscribers choose which notifications they would like to receive on their current browser in the future. It's a way to remember the notification preferences.
Tags let you track features associated to users.
You can send web push notifications only to a particular user by using the user id.
You want to send a message to a particular user when something relevant happens to that user. User ids provide better security to make sure that you are sending the notification to the right subscriber.
You can set the tags and user id for a subscription using the JavaScript SDK.
You can set the tags and/or user id using the showConfirmBox command as shown below.
<script>
webpushify('subscribe', {tag: 'shopping-cart', userId: 'user01'});
</script>
Note: Please, remember that the user id must be unique.
Note: If a user is not subscribed to your web push notifications, they will not receive your notifications. If a user is subscribed with multiple browsers, the notification will be sent to all browsers.
In other words, the tags and user id are associated to the subscription not to a physical user.
You can set and update the tags and/or user id using the tags command at any point of your logic as shown below.
<script>
webpushify('tags', {tag: 'shopping-cart', userId: 'user01'});
</script>
You can clear the tags and/or user id using the tags command passing in an empty string as shown below.
<script>
webpushify('tags', {tag: '', userId: ''});
</script>
To use the tags, you should go to the Segments section and create a new Segment with a rule for your tag. Then when you create a notification, you must associate that Segment as the Target Segment for that Notification.
To use the user ids, when you create a notification, you must type in a valid user id for that the Notification.
Note: If you select a segment with tag rule and type in a valid user id, the user id overrides the segment rules.