If you're building a modern web application with frameworks like Next.js or React, an npm package is generally the better choice. It integrates with your application's codebase, supports framework-specific features such as server-side rendering and client components, and makes dependency management easier.
A JavaScript snippet, on the other hand, is often the quickest option for traditional websites or CMS platforms where you don't have a build process.
| Use an npm package if... | Use a script if... |
|---|---|
| You are building with Next.js, React, or another JavaScript framework | Your site is built with WordPress, Shopify, Wix, or another CMS |
| You manage dependencies with npm | You want the fastest installation without changing your code |
| You want framework-native integration | You prefer a simple copy-and-paste setup |
CookieYes supports both approaches. For Next.js applications, you can install the official @cookieyes/nextjs package. For websites that don't use a JavaScript framework, you can integrate CookieYes by adding the standard installation script.