NextJS
Here are the steps for users to add your web analytics script to their Next.js project :
Steps to Add Script to a Next.js Project
Go to your SiteBehaviour Organisation's page and click on the Settings button for your site.
Go to the Tracking code tab.
Click on Copy to copy the Tracking Code to your clipboard.
In your Next.js project directory, find the
pages
folder. This folder contains the main entry point for your application, such as_app.js
or_app.tsx
.Open the
_app.js
(or_app.tsx
if you're using TypeScript) file in thepages
folder.At the top of your
_app.js
or_app.tsx
file, import theHead
component fromnext/head
.
7 . Add the Head
component to your custom App component and place your SiteBehaviour script inside it.
Last updated