Skip to content

npm Package — Overview

The @truconsent/consent-notice npm package provides a React component for consent banners. It is a client-side library — all API calls are made directly from the browser.

Two separate base URLs are involved:

VariableURLUsed for
VITE_TRU_CONSENT_API_URLhttps://trukit-dev.truconsent.ioTruConsentModal at runtime
VITE_TRU_CONSENT_MANAGEMENT_API_URLhttps://truapi-dev.truconsent.ioFetching assetId and bannerId
Terminal window
npm install @truconsent/consent-notice

Add these to your .env file before starting. Steps 1–3 walk you through finding each value.

# .env

# SDK runtime — used by TruConsentModal
VITE_TRU_CONSENT_API_URL=https://trukit-dev.truconsent.io

# Management API — used to fetch assetId and bannerId
VITE_TRU_CONSENT_MANAGEMENT_API_URL=https://truapi-dev.truconsent.io

# From Step 1 — generated in the platform dashboard
VITE_TRU_CONSENT_ORGANIZATION_ID=your-organization-id
VITE_TRU_CONSENT_ADMIN_API_KEY=your-admin-scope-key
VITE_TRU_CONSENT_API_KEY=your-consent-scope-key

# From Step 2 — discovered via the Management API
VITE_TRU_CONSENT_ASSET_ID=your-assetId

# From Step 3 — discovered via the Management API
VITE_TRU_CONSENT_BANNER_ID=your-bannerId
  1. Get API key and org ID — Generate credentials from the platform dashboard.

  2. Fetch asset ID — Discover your assetId via the Management API.

  3. Fetch collection point details — Discover your bannerId via the Management API.

  4. Integrate TruConsentModal — Add CSS imports and mount the component.