Vue
Vue apps can load PureStats once in the application HTML file.
Basic setup
Add the tracker to index.html:
<div id="app"></div>
<script defer src="https://purestats.io/pf.js" data-domain="example.com"></script>
This records the first pageview and listens for History API navigation.
Vue Router
If your router uses standard browser history, PureStats should track route changes automatically. For custom routing behavior, trigger a manual pageview after navigation:
router.afterEach(() => {
window.purestats?.trackPageview();
});
Use this only if automatic SPA tracking does not capture route changes. Duplicate pageviews can occur if both mechanisms fire.
Custom events
Track meaningful interactions:
window.purestats?.track('Trial Started', {
source: 'onboarding'
});
Event names should be stable. Avoid encoding dynamic values in event names; put them in properties instead.
Excluding internal routes
If the app includes private routes such as /admin, configure path exclusions in PureStats. This is easier to audit than adding conditional script loading across route components.