# How to install the cookie banner on version Next.js 13 and above?

> For the complete site index, see [llms.txt](/llms.txt). Every page is also available as Markdown: replace the trailing slash with `.md` (`/pricing/` becomes `/pricing.md`), or send `Accept: text/markdown` to the page URL itself.

Step-by-step guide to installing the CookieYes cookie banner on Next.js 13 and above, including the app router and server components.

---

**Last updated:** May 20, 2026
**URL:** https://www.cookieyes.com/documentation/installation-of-cookieyes-on-version-next-js-13-and-above/

---

To install the cookie banner, you can follow either of the two ways to add the third-party script to your Next.js project:
1. Navigate to **app>layout.js** and add the following steps, or
2. Navigate to the **pages>_app.js** and add the following steps.
**Step 1: Import the next/script component.**
To load CookieYes in your Next.js application, add the following import statement:

```js
import Script from 'next/script';
```

**Step 2: Add CookieYes script code.**
To enable CookieYes on your website, add the following CookieYes script code:

```js
<Script       
  src={`https://cdn-cookieyes.com/client_data/XXXXXXXX/script.js`}>
  </Script>
```

> **Note:**

> You need to replace ‘XXXXXXXX’ with your CookieYes website key.
>

You can copy your installation code from **Site Settings** from the top navigation panel of your CookieYes dashboard.

![Copy Code](https://assets.cookieyes.com/Copy_Code_42db741cc9.png)

**Step 3: Add the strategy property beforeInteractive.**
To ensure the script loads and executes without delaying the rendering of the page, add the following strategy below the CookieYes script code.

```js
strategy="beforeInteractive"
```

After completing the above steps, the file should be like this:

![code](https://assets.cookieyes.com/code_d97d3f4081.png)

> **Note:**

> CookieYes does not support the crossorigin attribute, as it may cause caching issues when used with the CookieYes script. If your website automatically adds this attribute when using the `Next.js `script component, we recommend using the standard `<script> `tag provided by CookieYes (installation script) instead to ensure that updates are applied immediately.
>


---

## Structured Data

```json
{
  "@context": "https://schema.org",
  "@graph": [
    {
      "@type": "Article",
      "headline": "How to install the cookie banner on version Next.js 13 and above?",
      "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https://www.cookieyes.com/documentation/installation-of-cookieyes-on-version-next-js-13-and-above/"
      },
      "url": "https://www.cookieyes.com/documentation/installation-of-cookieyes-on-version-next-js-13-and-above/",
      "publisher": {
        "@type": "Organization",
        "name": "CookieYes",
        "url": "https://www.cookieyes.com",
        "logo": {
          "@type": "ImageObject",
          "url": "https://www.cookieyes.com/cookieyes-logo.png",
          "width": 2048,
          "height": 2048
        }
      },
      "description": "Step-by-step guide to installing the CookieYes cookie banner on Next.js 13 and above, including the app router and server components.",
      "datePublished": "2023-03-17T02:36:44+00:00",
      "dateModified": "2026-05-20T09:04:48+00:00",
      "author": {
        "@type": "Person",
        "name": "CookieYes Doc Team"
      },
      "image": [
        "https://assets.cookieyes.com/cookieyes.png"
      ]
    },
    {
      "@type": "BreadcrumbList",
      "@id": "https://www.cookieyes.com/documentation/installation-of-cookieyes-on-version-next-js-13-and-above/#breadcrumb",
      "itemListElement": [
        {
          "@type": "ListItem",
          "position": 1,
          "name": "Home",
          "item": "https://www.cookieyes.com/"
        },
        {
          "@type": "ListItem",
          "position": 2,
          "name": "Documentation",
          "item": "https://www.cookieyes.com/documentation/"
        },
        {
          "@type": "ListItem",
          "position": 3,
          "name": "How to install the cookie banner on version Next.js 13 and above?",
          "item": "https://www.cookieyes.com/documentation/installation-of-cookieyes-on-version-next-js-13-and-above/"
        }
      ]
    },
    {
      "@type": "WebSite",
      "@id": "https://www.cookieyes.com/#website",
      "url": "https://www.cookieyes.com/",
      "name": "CookieYes",
      "description": "CookieYes is a Google-certified consent management platform that helps businesses comply with GDPR, CCPA, and other global privacy laws.",
      "inLanguage": "en-US",
      "publisher": {
        "@id": "https://www.cookieyes.com/#organization"
      },
      "potentialAction": {
        "@type": "SearchAction",
        "target": {
          "@type": "EntryPoint",
          "urlTemplate": "https://www.cookieyes.com/?s={search_term_string}"
        },
        "query-input": {
          "@type": "PropertyValueSpecification",
          "valueRequired": true,
          "valueName": "search_term_string"
        }
      }
    },
    {
      "@type": "Organization",
      "@id": "https://www.cookieyes.com/#organization",
      "name": "CookieYes",
      "url": "https://www.cookieyes.com/",
      "logo": {
        "@type": "ImageObject",
        "@id": "https://www.cookieyes.com/#/schema/logo/image/",
        "inLanguage": "en-US",
        "url": "https://www.cookieyes.com/cookieyes-logo.png",
        "contentUrl": "https://www.cookieyes.com/cookieyes-logo.png",
        "width": 2048,
        "height": 2048,
        "caption": "CookieYes"
      },
      "image": {
        "@id": "https://www.cookieyes.com/#/schema/logo/image/"
      }
    }
  ]
}
```
