Where to put analytics code in Next.js?

Where’s the right place to put analytics code for a next.js app using Plasmic? Things like GA4 or Segment’s analytics.js? They need to emit an event for every page view at minimum.

Does anyone have any sample code? It would be cool to see this covered in the docs / starter apps :slight_smile:

Hi, does this help? https://www.google.com/amp/s/mariestarck.com/add-google-analytics-to-your-next-js-application-in-5-easy-steps/amp/

(No difference when using Plasmic)

Thanks! Makes sense that this isn’t plasmic-specific now that I get how the pages work.