Load the script once in your root layout, then put the box in any component.
app/layout.tsx
import Script from "next/script";
<Script src="https://askthissite.com/embed.js" strategy="afterInteractive" />
Any component
<div data-everypage-site="YOUR-SITE-ID" />
Boxes on pages you move to later mount by themselves, so client-side navigation needs nothing extra.
Your site id is on your site's page after you sign up.