Next.js
1.Site analytics
- Open the site in Studio and copy the Embed snippet
src,data-site, anddata-keyvalues. - In the App Router, open
app/layout.tsx(or your root layout). - Add a deferred Script from
next/scriptwithstrategy="afterInteractive"(or inject the same attributes via a raw script in the root layout). - Set
srcto the tracker URL and passdata-siteanddata-keyas data attributes. - Deploy.
- Load a public route and confirm a visit in Site Analytics.
For the Pages Router, place the same Script in pages/_app.tsx or pages/_document.tsx so it loads once for every page.
2.Blog
- Open the site in Studio and go to Settings β Domain.
- Connect
blog.yourdomain.com, add the CNAME Studio shows, then verify. - In the site header or nav, link Blog to
https://blog.yourdomain.com. - Optional: in
next.config, redirect/blogand/blog/:path*to that host so older paths still land on the posts. - To render posts inside the Next.js app instead, open Settings β API and use the public list and post endpoints.