Targeting options for web push notifications
You can send a web push notification to all your subscribers or reach only some of them: Pushpad offers different ways to target specific users or segments.
Multiple projects
You can create multiple projects for each website. Each project has a list of subscribers and is similar to a "mailing list". You can create projects manually from the Pushpad dashboard (or use the REST API).
Warning: you can use multiple projects for the same domain, but they must be associated to the same sender.
Use multiple projects when:
- your website has a limited number of independent sections that don't change much over time. The communications are usually different for each group. For example a University may have two distinct projects, one for the communications with students and one for the communications with the professors. If you have many sections please consider using tags instead, which are a more flexible solution: you can then created saved segments.
- you need complete separation between different environments. For example you may have separate projects for development, staging and production.
Tags
Inside a project, you can use tags to segment your audience and create groups of devices that can be targeted together. Unlike projects, tags are dynamic and can be created on the fly. Usually you add tags to a browser subscription using the Javascript SDK.
Use tags when:
- you have many segments, overlapping segments or segments generated dynamically. For example you can track the browsers which visit a page or perform an action on your website, in order to target them later.
- you want to let the user choose which notifications wants to receive on the current browser (example). For example you can add some checkboxes to your website, one for each topic, and use tags to memorize the notification preferences of the user (like email preferences, a user may want receive notifications about some topics and not about others).
- you want to track the user features (example). Note however that tags are associated to the browser subscription, not to a user. For example a user may use different browsers and each browser has a its own set of tags: if you add a tag with the Javascript SDK, it is added only to the current browser. If you have a web app with registered users, you should cosider using the user IDs for targeting, instead of tags. Tags are mainly intended for marketing campaigns or to track user features when users are not logged in on your website, while user IDs are more suited for transactional notifications which require an higher level of security.
You can read more about tags.
Users
You can send web push notifications only to specific users or group of users by using their user ID (uid). You can set the user ID for a subscription using the Javascript SDK.
Use the user IDs when:
- you have a web app with registered users that needs to send transactional notifications. A transactional notification is a notification that is sent automatically to a user or a group of users when something relevant happens. For example you may want to notify a message in a chat, a new post in a group, a new comment to a post, an event nearby, the delivery of a package, etc. You should always prefer the user IDs to tags for transactional notifications, so that you don't have to keep data syncronized between your application and Pushpad; moreover user IDs require a signature and provide better security than tags. Although we don't enforce an hard limit on the number of recipients, if you need to reach more than 10k users with a transactional notification, you may need to send multiple notifications with the same content, splitting the recipients in batches of 10k.
You can read more about user IDs.
Notification preferences
Sometimes you want to allow the user to opt in only to certain notifications while muting others.
-
Use tags (or multiple projects) if you want to manage notification preferences for each browser. You can create a page with a checkbox for any topic that the user might want to receive. On page load use the
status
command of the Javascript SDK to properly initialize the status of checkboxes (checked or unchecked). Then when the status of a checkbox changes you callsubscribe
orunsubscribe
for that topic (i.e. tag). Because tags are associated to a browser, if the browser subscription is removed then also tags are removed. - As an alternative to tags, if the users are logged in on your website, you can memorize the user preferences in your database. Then your app is responsible for determining the users who want to receive a notification and reach only them using their user IDs (uids). In this case the notification preferences are associated to the user rather than to the browser.