I mentioned my top choices for analytics tools (Pirsch & Plausible), but feel free to integrate any other tool you prefer and place it in the <head> of the layout.tsx file.
Some browsers and ad-blockers might block the requests to the Pirsch JavaScript file. To solve this add a rule in next.config.js that reroutes requests to the correct Pirsch Analytics file.
Get insights into your website traffic with Pirsch Analytics. You can copy the tracking script from the dashboard and add it to your website.
Paste the script in the <head> tag of the layout.tsx file of your website.
src/app/layout.tsx
Copy
<head> {/* Place here your Analytics script */} <!-- the script looks like the following: --> <script defer src="/pa.js" id="pianjs" data-code={process.env.PIRSCH_ID!}></script></head>...
Some browsers and ad-blockers might prevent the Simple Analytics JavaScript file from loading. To solve this add a rule in next.config.js that reroutes requests to the correct Simple Analytics file.
Get insights into your website traffic with Simple Analytics. You can copy the tracking script from the dashboard and add it to your website.Place the script in the providers component under the Analytics section. Import the Script component from next/script.
After adding the script, you can view the analytics in the dashboard. You can see the number of visitors, page views, and referrers. You can also see the number of visitors per country and the most visited pages.
If you need more analytics documentations or have any questions, feel free to
ask in the Discord community or contact us
here.