LogoLogo
Sign inSign up
  • PushPushGo Documentation
  • Web push
    • Overview
    • Instructions
      • Subscription tests
    • Service worker
      • Subdomains / Wildcards
    • Integration script
      • Subscription form
        • Subscription form creator
          • Topics
        • Subscription form delay
        • Display form rules
        • Confirmation window
      • Bell widget
        • Inbox
        • Topics
      • Google Analytics & Google Tag Manager
      • Default notification
      • Beacons
      • Security SRI / CSP
    • SDK Client
      • Legacy SDK (deprecated)
        • Examples
    • JS Code
    • Safari support
    • FAQ
  • Mobile push
    • Overview
    • Google Android
    • Apple iOS
    • Huawei Android
  • ONSITE NOTIFICATIONS
    • Overview
  • Onsite notifications
    • Create onsite notification
    • Edit onsite notification
    • Onsite notification report
    • Inbox
  • Onsite notifications list
  • WHATSAPP CHANNELS
    • Overview
  • Whatsapp channel
    • Create a channel
    • Subscribers
    • Create a WhatsApp message
  • Subscribers
    • Subscribers
      • Activity status
      • Subscriber Details
    • Labels
      • System Labels
      • Add Labels Manually
    • Segments
      • Create Segment
      • Copy Segment
      • Update Segment
      • Delete Segment
    • Geolocation
  • Campaigns
    • Campaigns
    • Push campaign
      • Create Campaign
        • Content
        • Audience
          • By Segment
          • By Labels
        • Provider options
        • Time
        • Drafts
      • Campaign List
        • Cancel Campaign
        • Copy Campaign
        • Copying and pasting campaigns between projects
        • Delete Campaign
      • Campaign Report
    • AB test
      • Create AB test
        • Variants
        • Audience
        • Provider options
        • Time
        • Save draft or accept a test
      • AB test list
      • Winner selection
      • AB test report
      • Cancel AB Test
      • Send AB test saved as draft
      • Resend AB test
      • Delete AB test
    • RSS campaign
      • Create RSS campaign
      • Audience
      • Enable RSS campaign
      • RSS campaign report
    • Chrome plugin for Rocket push
    • Multi Push
    • Daily push capping
    • Planner
    • FAQ
  • Automation
    • Overview
    • Automation
      • Create automation
        • Name
        • Flow
        • Renew flow
        • Start date
        • End date
        • Building the flow
        • Step
          • Trigger
          • Campaign
            • Create campaign
            • Edit campaign
            • Campaign templates
      • Edit automation
        • Update automation
      • Report
        • Automation report
        • Campaign report
    • Automation list
      • Prority
      • Action
      • Status
      • Reset flow time
  • Analytics
    • Project analytics
      • Subscribers
      • Campaigns
      • Automation
    • Organization analytics
      • Organization dashboard
        • Subscribers
        • Campaigns
        • Automation
      • Project comparison
    • Exports
  • Integrations
    • Webhooks
    • REST API Reference
  • Release notes
Powered by GitBook
On this page
  • 📦 Script Types Comparison
  • 🧩 Service Worker Strategies
  • ❄️ Freeze Mode Explained
  • ✅ Recommended for secure setup (All-in-One)
  • 🔁 Update Checklist (AIO mode)

Was this helpful?

  1. Web push
  2. Integration script

Security SRI / CSP

How to self-host or use SRI / CSP with our scripts

In integrating our scripts into your website, you can choose between two main types of JavaScript scripts entrypoints and two Service Worker deployment strategies. This document explains their differences, advantages, drawbacks, and how to implement a secure setup using CSP and SRI.


📦 Script Types Comparison

Script Type
Size
Dynamic Loading
CSP Compatibility
SRI (Integrity) Support
Self-hostable

Chunked

~14 KB + ~140 KB of dynamic loaded modules

✅ Loads from /scripts/{version}/ppg-*.js

❌ Harder (many sources)

❌ Not supported for dynamic chunks

❌ No

All-in-One (AIO)

~140 KB

❌ No dynamic loading

✅ Simple

✅ Fully supported

✅ Yes


✅ All-in-One (AIO)

Advantages:

  • Simpler CSP (script-src with hash or 'self')

  • Full SRI support (integrity attribute)

  • Can be self-hosted (e.g., from your CDN)

  • Single HTTP request

Disadvantages:

  • Larger file (~140 KB)

  • Slower perceived performance (everything loads upfront)

Example with SRI:

<script
  charset="UTF-8"
  src="https://s-eu-1.pushpushgo.com/js/{projectId}/aio.js"
  integrity="sha384-<YOUR_HASH>"
  crossorigin="anonymous"
  async="async">
</script>

🚀 Chunked Scripts (Dynamic)

Advantages:

  • Smaller entrypoint (~14 KB)

  • Dynamic module loading as needed

  • Better time-to-interactive (TTI)

Disadvantages:

  • CSP setup is harder due to multiple dynamic sources

  • No SRI support for dynamically loaded scripts

  • Cannot self-host dependent scripts

Example:

<script
  charset="UTF-8"
  src="https://s-eu-1.pushpushgo.com/js/{projectId}.js"
  async="async">
</script>

🧩 Service Worker Strategies

PushPushGo integration also requires a Service Worker. You have two main options:

Approach

Uses importScripts

CSP-compatible (worker-src 'self')

SRI Support

Self-hostable

ImportScripts

✅ Yes

❌ No

❌ No

❌ No

Downloaded

❌ No

✅ Yes

✅ (N/A)

✅ Yes


✅ Recommended for better security: Downloaded Worker (sw.js)

Benefits:

  • Allows full control over CSP (worker-src 'self')

  • Self-hostable and auditable

How to fetch:

wget https://s-eu-1.pushpushgo.com/{projectId}/worker.js -O sw.js

HTML CSP Example:

<meta http-equiv="Content-Security-Policy" content="
  script-src 'self' 'sha384-<HASH>';
  worker-src 'self';
">

❄️ Freeze Mode Explained

PushPushGo offers a feature called Freeze. When enabled:

The project configuration is locked. Any future changes made in the dashboard (e.g., selectors, feature toggles, popup forms) will not propagate to production environments.

This is especially useful when you:

  • Host AIO scripts or workers from our CDN and want to control, audit our "changes"

  • Want stable script versions without unexpected changes

  • Need to ensure CSP and SRI hashes remain valid

How to enable Freeze:

  • Go to: Project > Settings > Integration > Web push integration

  • Enable the Freeze option

  • Wait 2–3 minutes for CDN cache to sync


✅ Recommended for secure setup (All-in-One)

  • Use aio.js

  • Calculate SHA-384 hash (update {projectId} before execute):

curl -s https://s-eu-1.pushpushgo.com/js/{projectId}/aio.js | openssl dgst -sha384 -binary | openssl base64
  • Update <script> tag with SRI

  • Download and host sw.js locally

Final CSP example:

<meta http-equiv="Content-Security-Policy" content="
  script-src 'self' https://s-eu-1.pushpushgo.com/js/{projectId}/aio.js 'sha384-<HASH>';
  worker-src 'self';
">

🔁 Update Checklist (AIO mode)

  1. Fetch new version of aio.js

  2. Recalculate SHA-384 SRI hash

  3. Update script tag in HTML

  4. Update CSP meta tag with new 'sha384-...'

  5. Update local sw.js

Stay secure! if you have any questions please contact with our customer support

Last updated 21 days ago

Was this helpful?