Docs Any website
Single-page apps
Count in-app navigation as page views.
In a single-page app the browser loads one page and the app changes the screen itself, often by changing the address after #. Without help, analytics sees one page view per visit.
Add spa: 1 to the configuration:
<script>window.OPL_INSIGHTS = { m: 'https://insights.opl-web.com/', s: 129, spa: 1 };</script>
<script async src="https://insights.opl-web.com/plugins/OplReplay/javascripts/opl-insights.js"></script>
The script then watches the address. Each time it changes (pushState, replaceState, a hash change or the back button) it sends a page view with the new address and the page title, and marks the new screen in the recording's timeline.
It waits about half a second after the change so your app can set the new title first.
Signed-in users in a single-page app
Login usually happens inside the app, without reloading the page. Call setUser when it succeeds and clearUser on sign-out; see identify signed-in users.