Radar is designed to work seamlessly with modern Single-Page Applications (SPAs) built with frameworks like React, Vue, or Svelte, which your customers may be using.

Automatic Pageview Tracking

By default, Radar automatically detects client-side route changes on your customer’s website. It achieves this by “monkey-patching” the browser’s native History API (pushState and replaceState) and listening for the popstate event. This means that for the vast majority of your customers’ SPAs, you do not need to provide any extra configuration to get accurate pageview tracking. As long as their routing library uses the standard History API, Radar will automatically fire a $pageview event every time the route changes.

Manual Tracking with the page Method

In some rare cases, your customer may need to manually tell Radar when a pageview has occurred. The YourAppName.page() method is provided for these scenarios. You should advise your customers to use this if:
  • Their application uses a routing library that does not interact with the browser’s History API in a standard way.
  • They want to record a pageview for an interaction that doesn’t change the URL, such as opening a significant modal window.
To manually trigger a pageview, your customer would call the page method:
// Your customer would call this to manually trigger a pageview event
YourAppName.page();