You can use web push notifications to re-engage your users in many different ways. For example you can send transactional notifications to specific users when something happen or you can send large campaigns to all your subscribers. However in this tutorial we show a way to send notifications specifically to users who become inactive.
Re-engage registered users
If your customers sign up to your website you probably have specific information about them in your database, for example:
- last login date
- last purchase date
- last time they performed a specific action
Once you have that information, you can run a daily cron job on your server which runs the following steps:
- Find users in your database that have performed a given action N days ago (e.g. find users whose last login is 7 days ago)
- Send a notification to that users (e.g. “We haven’t seen you in the last week. See what’s new!”)
Re-engage anonymous users
Websites like blogs don’t require a sign up and you can’t use the previous strategy. However you can still re-engage your inactive users that haven’t visited your website recently.
You can use tags on the web push subscription to track the last visit of a browser to your website. For example:
Then you can run a daily cron job on your server to send the notifications to inactive users:
$notification1 = new Pushpad\Notification(['body' => "We haven't seen you in the last week. See what's new!"]); $notification1->broadcast(['tags' => ['lastseen:' . date('Y-m-d', strtotime('-7 days'))]]); $notification2 = new Pushpad\Notification(['body' => "We haven't seen you in the last month. See what's new!"]); $notification2->broadcast(['tags' => ['lastseen:' . date('Y-m-d', strtotime('-30 days'))]]); # ...