Next.js / React
Render the snippet from your root layout.
In a React framework, render the snippet from your root layout or document so it loads on every route.
- 1In Next.js, add the script to your root layout using the framework Script component with the afterInteractive strategy.
- 2In other React apps, add the script tag to your index HTML head.
- 3Rebuild and verify a pageview in Analytics.
Tracking snippet
<script
defer
data-key="lw_xxxxxxxx"
src="https://localwrangler.com/track.js"
></script>Keep the defer attribute. The script is built to load without blocking your page render.