Web Analytics for SPAs
Cloudflare Web Analytics can automatically track user interactions on Single Page Applications (SPAs) by overriding the History API’s pushState
function and listening to the onpopstate
event. Note that hash-based routers are not supported.
If you want to disable the automatic tracking for SPAs, you can do so by adding the spa
option with a value of false
in the data attribute of the script tag, as shown below:
If you are using Google Tag Manager (GTM), you can disable SPA tracking by passing the spa option via the query string in the script URL: