npm install @visitorquery/react
Once the package installed, add the provider in your layout or page component:
How to create page views
Since navigation in modern SPAs is often done without a full page reload, adding pageviews can be tricky. Our provider usesuseEffect
internally and re-runs when the parameters change.
In this case you can utilize the trigger
param to trigger a pageview when your route changes like in the following NextJS example: