LogoLogo
  • Home
  • Integration & SDKs
    • Web / Browser Push
      • Wordpress Integration Steps
      • Wix Integration Steps
      • Safari
        • Safari on Desktop
        • Safari on Mobile (iOS / iPadOS)
      • SDK
        • SDK Methods
        • SDK Events
        • Customizing Prompt CSS
        • AMP Support
        • E-Commerce / Abandoned Cart
    • Native App Push
      • Apple / iOS
        • P8 Key or P12 Cert Setup
        • SDK: Swift / Obj-C
          • Activity Tracking
          • Deep Linking
          • Live Activities
          • App Messages
          • Identity Synchronization
          • SDK Methods
          • SDK Delegates
        • SDK: React Native
        • SDK: Flutter
        • Advanced
          • Self-Managed Integration
        • iOS SDK Changelog
      • Android
        • Firebase App Setup
        • SDK: Kotlin / Java
          • Deep Linking
          • Activity Tracking
          • App Messages
          • Identity Synchronization
          • SDK Methods
          • SDK Callbacks
          • Live Activities
        • SDK: React Native
        • SDK: Flutter
        • Advanced
          • Self-Managed Integration
        • Android SDK Changelog
      • React Native
        • Android: Firebase App Setup
        • iOS: P8 Key or P12 Cert Setup
        • SDK: React Native
          • Deep Linking
          • Activity Tracking
          • Subscriber Matching
          • Live Activities
          • App Messages
          • SDK Methods
        • React Native SDK Changelog
      • Flutter
        • Android: Firebase App Setup
        • iOS: P8 Key or P12 Cert Setup
        • SDK: Flutter
          • Deep Linking
          • Activity Tracking
          • Subscriber Matching
          • Live Activities
          • App Messages
          • SDK Methods
  • API
    • API Access Management
    • API Reference
  • Platform
    • Dashboard
    • Notifications
      • A/B Testing
      • Custom Buttons
      • Notification Previews
      • Inline Segmentation
      • Notification Templates
      • Macros
      • Native App Push Notifications
    • App Messages
    • Segments
      • Custom Geo Segmentation
    • Campaigns
    • Insights
    • User Management
    • Organizations
      • Multi-Factor Authentication
      • Single Sign On
        • Google Workspace
        • Microsoft Azure AD
        • Okta Workforce
      • Multi-Domain Notifications
      • Multi-Domain Segments
      • API Access
    • Multi-Channel Notifications
  • Info Center
    • Launch Guide & Best Practices
      • Landing Domain Whitelist
    • Web / Browser Push
      • Common Questions
      • Browser Support
      • Retrieve Push User ID
      • Not Getting Prompted
      • Not Receiving Notifications
      • How to Unsubscribe
    • Native App Push
      • Retrieve Push User ID
    • Workflow Planning
Powered by GitBook
On this page
  • Requirements
  • Steps
  • Step 1: Place the Service Worker File
  • Step 2: Add the Integration HTML
  1. Integration & SDKs

Web / Browser Push

PreviousHomeNextWordpress Integration Steps

Last updated 1 year ago

Requirements

Support for web push notifications requires:

  • Your website to be SSL-enabled (https://)

  • One publicly-accessible file to be placed on your site

  • A snippet of Integration HTML to be added to each page on your site.

    • This can also be done with a tag manager.

Steps

If your site uses Wordpress you can skip these steps and follow the steps for an easier implementation.

Step 1: Place the Service Worker File

Download the Service Worker from () and place it in a publicly accessible location on the same domain that serves your site. For example: https://www.example.com/assets/pushly/pushly-sdk-worker.js

This file must be served from the same origin the potential subscriber is on when they visit your site. It cannot be served from a separate domain or subdomain. For example, if your visitor is on www.example.com the service worker must be located on www.example.com. It cannot be served from assets.example.com or examplecdn.com.

Also note that it cannot be served from behind a 301/redirect.

Step 2: Add the Integration HTML

If you placed the Service Worker in a subdirectory on your domain follow the steps in the Service Worker Placed in Subdirectory tab otherwise select the Service Worker Placed in Public Root tab below.

Add the following HTML snippet to the head section of your site and replace both instances of SDK_KEY with the value provided by your account manager.

Also, replace the /absolute/path/to/pushly-sdk-worker.js text in the snippet with the full path to the Service Worker.

<script src="https://cdn.p-n.io/pushly-sdk.min.js?domain_key=SDK_KEY" async></script>
<script>
  window.PushlySDK = window.PushlySDK || [];
  function pushly() { window.PushlySDK.push(arguments) }
  pushly('load', {
    domainKey: 'SDK_KEY',
    sw: '/absolute/path/to/pushly-sdk-worker.js',
  });
</script>

The sw property should not include the origin/domain. It should be a path only; I.e., do not include https:///www.example.com in this value.

Add the following HTML snippet to the head section of your site and replace both instances of DOMAIN_KEY with the value provided by your account manager.

<script src="https://cdn.p-n.io/pushly-sdk.min.js?domain_key=DOMAIN_KEY" async></script>
<script>
  window.PushlySDK = window.PushlySDK || [];
  function pushly() { window.PushlySDK.push(arguments) }
  pushly('load', {
    domainKey: 'DOMAIN_KEY',
  });
</script>

Wordpress Plugin
our CDN
https://cdn.p-n.io/pushly-sdk-worker.js