<\/span><\/h1>\nWe’re all familiar with push notification on our phones. This is where an app sends you a notification or alert even though you’re not engaging with the app at that time. <\/span><\/p>\nWebsite notifications work in a similar manner. They do this by allowing you to send notifications to users who have subscribed to your website. In this article I’ll show you how to add web push notifications to your WordPress site.<\/span><\/p>\n<\/span>Why Push Notifications?<\/span><\/h2>\nYou might be wondering, why bother with web push notifications. Web push notifications allow you to reach users across multiple devices. They can convert these visitors into customers and active followers. You also can regularly get visitors to come back to your website much sooner than usual. <\/span><\/p>\nThe best part is that it doesn’t require a lot of commitment from the user. They can control how their devices show these notifications.<\/span><\/p>\n<\/span>How to Begin Setting up Push Notifications<\/span><\/h2>\nTo add push notifications to your WordPress website, you’ll first need a push notification service. For the purpose of this article we’ll choose OneSignal. OneSignal has free option for their WordPress push notification service. It’s also pretty straightforward to set up.<\/span><\/p>\nTo begin the setup, install and activate the OneSignal plugin. When you activate it you’ll see a new tab on the left column.<\/span><\/p>\nNext, we’ll head to OneSignal website and create an account. After successfully creating an account and logging in, go to your OneSignal dashboard. Click on the Add App button as shown below to create your first app for push notifications.<\/span><\/p>\nYou’ll need to pick a name for your app. You can use any name you wish, but make it something memorable.<\/span><\/p>\n<\/p>\n
The next step will be to select a platform that you’ll be targeting with push notifications. Choose Web Push for now.<\/span><\/p>\n<\/p>\n
<\/p>\n
<\/p>\n
On the next screen you’ll be asked to choose an integration method. In our case we are using WordPress so click on WordPress Plugin. Alternatively, you can click Website Builder then click on the WordPress logo below that.<\/span><\/p>\n<\/p>\n
Next, scroll down to the WordPress Site Setup. This includes your site name, site URL, and upload an icon. This icon will be displayed in notifications so you want to make it your logo or a memorable version of it. If you have a favicon, it may be best to use it here.<\/span><\/p>\n<\/p>\n
<\/span>The Importance of Having an SSL Certificate<\/span><\/h2>\nHaving an SSl certificate is pretty standard these days, and I’d recommend having one. For this last step you’ll need to choose if you have an SSL certificate or not. Push notifications can only be sent through secure SSL connection. If you don’t have SSL installed, turn this option off. <\/span><\/p>\nOneSignal gives you an option to send your notifications through them if you don’t have SSL. You’ll need to enter a label under the HTTPS toggle. This label becomes your subdomain on the OneSignal platform. Your push notifications will be sent through this sub domain.<\/span><\/p>\nAt this point you’re done. Click the save button to save all your settings. <\/span><\/p>\n<\/span>API ID and API Key<\/span><\/h3>\nOn the next screen you’ll see API ID and API key which you’ll need to copy back to your WordPress website.<\/span><\/p>\n<\/p>\n
Go to your WordPress admin and find OneSignal settings page. Click on the Configuration Tab. Here, enter the API ID and API key.<\/span><\/p>\n<\/p>\n
You’re almost there. The app you set up will only allow you to send notifications through Google Chrome and Firefox browsers only. We’ll need to add Safari ID as well in order to send notifications through the Safari browser. <\/span><\/p>\nLet’s go back to the OneSignal dashboard and find our app. Next to your app’s settings page. Under Web Push Platforms, click on the edit icon next to Apple Safari. <\/span><\/p>\nOn the next screen you’ll need to enter your site name, URL and upload a logo then save your settings by clicking on the Save button. On the next screen you’ll see your Safari ID. Copy it and go back to the Configurations tab and enter it there.<\/span><\/p>\n<\/p>\n
<\/span>Testing Your Push Notification<\/span><\/h3>\nUsing the incognito or private window of your browser, visit your website. If all went well you’ll see a push notification popup and a bell icon at the bottom right corner of your website.<\/span><\/p>\nIf for some reason the process is not working for you I recommend reaching out to OneSignal support. They should be able to help you out regardless if you’re on a free or paid plan.<\/span><\/p>\n