Skip to content
npm package

Install COKIQ in React

Install the @cokiq/react helper or place the universal script once in the app shell for Vite and other React single-page apps.

Install in 3 steps

  1. Install @cokiq/react or paste the universal COKIQ script into index.html.
  2. Use the site key for the production domain and load COKIQ once at the app root.
  3. Deploy and test on the production URL.

Package install

npm i @cokiq/react

Universal script

Works on any site that allows custom code in the head. Replace YOUR_SITE_KEY with the key from your COKIQ dashboard. Use one install path per site.

<script src="https://cokiq.com/api/s/YOUR_SITE_KEY" data-key="YOUR_SITE_KEY"></script>

Check that it works

  • The banner appears after the app loads.
  • Route changes do not create a second banner.
  • Consent logs are stored under the right site key.

Questions

Do I need the npm package?

No. The universal script in index.html works too. The package is a convenience for React apps.