Developer Guide
API GuideDeveloper Guide
  • Overview
    • Getting Started
    • Customers and Visitors
    • Events and Business Objects (BOs)
      • Sample Event Templates
  • Website
    • Getting Started
      • Direct JS Implementation
      • JS Integration via GTM
      • Tracking Haravan website events
    • Tracking Users
    • Tracking Events
      • [Direct] Sample E-Commerce Events
        • View Product
        • Add a Product to the Shopping Cart
        • View the Shopping Cart
        • Remove a Product from the Shopping Cart
        • Search for Product(s)
        • Checkout Shopping Cart
        • Apply Promotion Code
        • Purchase Product(s)
      • [GTM] Sample E-Commerce Events
        • View Product
        • Add a Product to the Shopping Cart
        • View the Shopping Cart
        • Remove a Product from the Shopping Cart
        • Search for Product(s)
        • Checkout Shopping Cart
        • Apply Promotion Code
        • Purchase Product(s)
    • Web Push
  • Android
    • Getting Started
    • Tracking Users
    • Tracking Events
    • Push Messaging
    • App Inbox Messaging
  • iOS
    • Getting Started
      • Integration of Antsomi iOS SDK
    • Tracking Users
    • Tracking Events
    • Push Messaging
  • Hybrid Apps
    • React Native
      • Tracking Users
      • Tracking Events
        • Sample E-Commerce Events
          • View Product
          • Add a Product to the Shopping Cart
          • View the Shopping Cart
          • Remove a Product from the Shopping Cart
          • Search for Product(s)
          • Checkout Shopping Cart
          • Apply Promotion Code
          • Purchase Product(s)
      • Push Messaging
      • App Inbox Messaging
    • Flutter
      • Tracking Users
      • Tracking Events
        • Sample E-Commerce Events
          • View Product
          • Add a Product to the Shopping Cart
          • View the Shopping Cart
          • Remove a Product from the Shopping Cart
          • Search for Product(s)
          • Checkout Shopping Cart
          • Purchase Product(s)
      • Push Messaging
      • App Inbox Messaging
      • App In-line Content
  • Antsomi Service Integrations
    • Media Template
    • Media JSON
      • Sample E-Commerce Events
        • Search for Product(s)
        • View Product
        • Add a Product to the Shopping Cart
        • Checkout Shopping Cart
        • Purchase Product(s)
      • Sample User Events
        • Sign-in
        • Sign-up
      • Sample Opt-in Events
        • Subscribe to Email marketing
        • Subscribe to OneSignal channel
  • 3rd Party Integrations
    • Shopify
      • Tracking Shopify website events
    • LINE
      • Integrating LINE Login with your web app
    • Google Ad Manager
      • Targeting CDP365 segment via PPID(s)
Powered by GitBook
On this page
  • Initialization
  • Adding Service Worker
  1. Website

Web Push

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 -->
<script src="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.

Integrating Antsomi WebPush Service Worker Files

PreviousPurchase Product(s)NextGetting Started

Last updated 1 year ago

Download sw.js Files:

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., .

link
https://example.com/sw.js
Example of the URL: https://example.com/sw.js