This is a tutorial on utilizing airship in your web app. This demo includes a non-sensitive SDK & API key for a default Airship demo.
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function() {
navigator.serviceWorker.register('/sw.js').then(function(registration) {
// Registration was successful
console.log('ServiceWorker registration successful with scope: ', registration.scope);
}, function(err) {
// registration failed :(
console.log('ServiceWorker registration failed: ', err);
});
});
}
</script>
*This is sourced from the Google Developer docs. Make sure to change the .register('/sw.js') to .register('/push-worker.js').
Step 9: Run index.html on a live server. Right click > Inspect > Console > Ensure the service worker registration is successful
To allow notifications for your browser (this is usually ran with a button displayed on the frontend).
To get the user identifier of the browser (usually this works in tandem with the user login info)
Make sure to copy that number.
For large scale projects your groups will most likely be sectioned by user-type, etc.
Your User Identifier is the number discovered in Step 13
In this case I chose the All Users group. Normally you would target specific users or test users.
This is a UX preference. Select items that match your UX needs.