Empower your web application with Antsomi WebPush to deliver impactful notifications, fostering effective engagement and communication. Web push notifications offer a dynamic avenue for timely, personalized, and efficient information delivery, enhancing user interactions with your website.
To kickstart the integration of Antsomi WebPush, follow these steps to load the SDK asynchronously. This ensures optimal page load times and a seamless integration process.
Initialization
Antsomi WebPush recommends loading webpush.js with the async flag so your page load times don't increase. To use it, place the following code before calling any other Antsomi WebPush functions.
<!-- CDP Web Insight script --><scriptsrc="https://st-a.cdp.asia/webpush.js"async></script><script>window.AntsomiPush=window.AntsomiPush|| [];AntsomiPush.push(function() {AntsomiPush.init({portalId: <PORTAL_ID>, // Replace it with your Portal ID }); });</script>
Adding Service Worker
What are Service Workers?
Web Push Notifications, excluding Safari, require Service Worker files on your domain for subscription and notification reception. These files are downloaded upon accepting web notifications.
Add Service Workers to the Website: The sw.js file must be publicly accessible and can be placed at the top-level root of your site, e.g., https://example.com/sw.js.