-
Notifications
You must be signed in to change notification settings - Fork 262
WS-1838: Add PWA Offline page tracking #13545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
DmitryGron
wants to merge
104
commits into
ws-1837-service-worker-changes
Choose a base branch
from
feature/WS-1838-pwa-offline-flag
base: ws-1837-service-worker-changes
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
WS-1838: Add PWA Offline page tracking #13545
DmitryGron
wants to merge
104
commits into
ws-1837-service-worker-changes
from
feature/WS-1838-pwa-offline-flag
+379
−3
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jinidev
reviewed
Dec 15, 2025
jinidev
reviewed
Dec 15, 2025
jinidev
reviewed
Dec 15, 2025
elvinasv
requested changes
Dec 15, 2025
Contributor
|
Can we add some tests around the new |
andrewscfc
reviewed
Dec 18, 2025
LukasFrm
approved these changes
Dec 23, 2025
andrewscfc
reviewed
Jan 2, 2026
Co-authored-by: Andrew Bennett <andrew.bennett07@bbc.co.uk>
andrewscfc
approved these changes
Jan 7, 2026
Contributor
andrewscfc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the changes 🚀
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Resolves JIRA: https://bbc.atlassian.net/browse/WS-1838
Summary
Adding flag for offline tracking
New Hooks:
useOfflinePageFlag - Sets flag when offline page visited in PWA
usePWAOfflineTracking - Fires pwa-offline-page-view event on offline→online transition
useSendPWAStatus - Sends PWA status to service worker
useServiceWorkerRegistration - Handles SW registration:
Added tests for all 4 hooks following codebase patterns
Fixed merge conflict in LatestMediaItem styles
Updated Storybook 10.0.8 → 10.1.10
Testing Instructions
How to test the offline flag and tracking
Setup:
Stop your dev server
Close Chrome completely and uninstall any existing PWA
Start the dev server: yarn dev
Go to http://localhost:7081/mundo/live/c7dkx155e626t?renderer_env=local
Install it as a PWA (click the install icon in the address bar)
Test the flag:
Once installed, refresh the page to make sure the offline page gets cached
Open DevTools, go to Network tab and set it to Offline
Refresh the page - you should see the custom offline page
Check Local Storage (in DevTools → Application → Local Storage)
You should see offline_page_visit with value "true"
Test the tracking event:
While still on the offline page with the flag set
Open the Console tab in DevTools
Switch Network back to Online
You should see a tracking beacon fire with event name pwa-offline-page-view and network type
Check Local Storage again - the offline_page_visit flag should be gone
Test it fires again:
Go offline again, refresh to see the offline page
The flag gets set again
Go back online
The event fires again and the flag is removed
That's it. The event should fire every time you go from offline → online after visiting the offline page.
Developer Checklist
Testing
Ready-For-Test, Local)Ready-For-Test, Test)Ready-For-Test, Preview)Ready-For-Test, Live)Additional Testing Steps
Useful Links