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
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:
🚀 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:
🧩 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
)
sw.js
)Benefits:
Allows full control over CSP (
worker-src 'self'
)Self-hostable and auditable
How to fetch:
HTML CSP Example:
❄️ 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
optionWait 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):
Update
<script>
tag with SRIDownload and host
sw.js
locally
Final CSP example:
🔁 Update Checklist (AIO mode)
Fetch new version of
aio.js
Recalculate SHA-384 SRI hash
Update
script
tag in HTMLUpdate CSP meta tag with new
'sha384-...'
Update local
sw.js
Stay secure! if you have any questions please contact with our customer support
Last updated
Was this helpful?