The front-end script calls navigator.sendBeacon('/wp-json/opwa/v1/beacon', JSON.stringify(payload)) for the following events:
| Event | Fields |
|---|---|
page_view | sw_active (bool), url |
cache_hit | url, cache_name |
cache_miss | url |
offline_session | url |
install_prompt_shown | — |
install | — |
install_dismiss | — |
sw_registration | — |
The REST endpoint (OPWA_Analytics::rest_beacon) writes to opwa_analytics, upserting one row per date.
