React framework integration for VisitorQuery
To use our services with React, you can use our React hook which is available at @visitorquery/react.
npm install @visitorquery/react
Once the package installed, add the provider in your layout or page component:
Simply by adding the provider, visitorquery will perform a check.
Since navigation in modern SPAs is often done without a full page reload, adding pageviews can be tricky. Our provider uses useEffect
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:
If you need details regarding the state of the check (started, ended, loading), in order to show/hide certain ui elements, use the provided hook:
The main script will be loaded automatically into the page and the hook will take care of the rest. For a complete example and more information please refer to the hook’s npm page.
React framework integration for VisitorQuery
To use our services with React, you can use our React hook which is available at @visitorquery/react.
npm install @visitorquery/react
Once the package installed, add the provider in your layout or page component:
Simply by adding the provider, visitorquery will perform a check.
Since navigation in modern SPAs is often done without a full page reload, adding pageviews can be tricky. Our provider uses useEffect
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:
If you need details regarding the state of the check (started, ended, loading), in order to show/hide certain ui elements, use the provided hook:
The main script will be loaded automatically into the page and the hook will take care of the rest. For a complete example and more information please refer to the hook’s npm page.