You can use web push notifications to create welcome series for the new users that sign up to your application. Let's see how to create a welcome series using Pushpad.
Welcome series after sign up
This strategy is for websites that want to send welcome series to users, after they sign up to the website.
- Users sign up normally to your application
- When users are logged in on your website you subscribe them to push notifications and you keep track of their user ID.
- You use a daily cron job to query your database and find the users that have registered the previous day (or 2 days ago, 3 days ago, etc.)
- You send a welcome notification to all the users that have signed up the previous day (or 2 days ago, 3 days ago, etc.). You can target them using their user IDs (see the libraries for sending the notifications).
Note that Pushpad itself uses this method to send a welcome series to all the new customers. For example at the moment we send a welcome notification to the users that have signed up the previous day, then another notification after 3 days and finally another notification after 6 days.
Welcome series after notification subscription
This strategy is for websites that want to send welcome series to a browser that has recently subscribed to your web push notifications.
First you need to subscribe a user to your web push notifications and keep track of the subscription date using tags:
pushpad('status', function (isSubscribed) {
// if the user is not subscribed...
if (!isSubscribed) {
// subscribe the user and track subscription date
var today = new Date().toJSON().slice(0,10);
pushpad('subscribe', function () {}, {tags: ['created:' + today]});
}
});
Then in your server you can run a daily cron job like:
$notification1 = new Pushpad\Notification(['body' => 'First day!']);
$notification1->broadcast(['tags' => ['created:' . date('Y-m-d', strtotime('-1 days'))]]);
$notification2 = new Pushpad\Notification(['body' => 'Second day!']);
$notification2->broadcast(['tags' => ['created:' . date('Y-m-d', strtotime('-2 days'))]]);
# ...