If you want your AMP pages to prompt users to subscribe to push notifications you first have to set up a few things.
Getting the necessary plugins
Assuming you have AMP and WP AMP Themes correctly set-up, you now need to get the OneSignal WordPress Plugin and set it up according to the in-menu setup guide. If you have any trouble you can also check the OneSignal Documentation.
Enable Push Notifications in the WP AMP Themes menu
Go into the WP AMP Themes plugin’s admin menu, check the “Display push notifications on AMP pages via the OneSignal plugin” box and click save.
Setting up AMP push notifications on HTTP
If your site is on http go through the following steps, otherwise skip to the next section.
- Make sure the “My site uses an HTTPS connection (SSL)” switch is set to off in the OneSignal plugin’s admin menu.
- Check that the “OneSignal Subdomain” field, “REST API Key” and “App ID” fields are set correctly and match the values from your OneSignal App Dashboard.
Setting up AMP push notifications on HTTPS
If your site is on https you need to:
- Make sure the “My site uses an HTTPS connection (SSL)” switch is set to on in the OneSignal plugin’s admin menu.
- Check that the “REST API Key” and “App ID” fields are set correctly and match the keys from your OneSignal App Dashboard.
- Make sure your “Wordpress Address (URL)” and “Site Address (URL)” (if applicable) begin with “https”.
- Make sure you have only one main url. Example: either “https://mysite.com” or “https://www.mysite.com” should work, not both.
Testing AMP push notifications
Get the AMP URL of one of your posts (by appending /amp to the post’s regular url) and paste the url into the AMP testing tool then click “Run Test”.
After the test runs you have to click on “Preview Search Result” which will show you how your AMP page will appear in Google Search.
Then simply click on the search result to see your AMP page with the Subscribe to Updates button. Feel free to click the button so that you can test out your push notifications.