Custom Scripts
Add analytics, tracking, or other custom scripts to your documentation.
Analytics
Google Analytics
Add to your layout.tsx:
import Script from "next/script";
export default function Layout({ children }) {
return (
<>
<Script src="https://www.googletagmanager.com/gtag/js?id=G-XXXXX" />
<Script id="google-analytics">
{`
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXX');
`}
</Script>
{children}
</>
);
}Plausible
<Script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js" />Custom Head Tags
Add meta tags or link elements in your layout:
export const metadata = {
other: {
"google-site-verification": "your-verification-code",
},
};