Next.js version 13+ (Using App Router)
Follow the below steps to integrate the Atatus RUM agent into yourNext.js 13+ application.
-
Paste the snippet into the root
layout.tsxfile.Here replaceYOUR_API_KEYwith your API Key. You will find this key in your browser project settings. - Restart your Next.js server.
Next.js version <13 (Using Page Router)
-
Create an
atatus.jsfile inside thepublic/jsfolder and paste our Atatus(async CDN)script. Make sure to remove the opening and closing<script>tags.Here replaceYOUR_API_KEYwith your API Key. You will find this key in your browser project settings. -
Next, you need to create a file called
_document.jsinside thepagesfolder. Add a<script>tag inside the<Head>tag as follows: - Restart your Next.js server.