C15T Logo

Offline

Store consent decisions in the browser with offline mode, perfect for sites without backend requirements

tocOn this page

The offline mode provides a simple, browser-based approach to storing user consent decisions without requiring a backend server.

Key Characteristics

  • No backend required - Everything is stored locally in the browser
  • Simplified setup - Get started quickly with minimal configuration
  • Independence - Works without external services or APIs
  • Fast implementation - Ideal for prototyping and simpler sites

Implementation

import { configureConsentManager, type ConsentManagerOptions } from 'c15t';

export const c15tConfig: ConsentManagerOptions = {
  mode: 'offline',
  consentCategories: ['necessary', 'marketing'], // Optional: Specify which consent categories to show in the banner. 
};

const c15t = configureConsentManager(c15tConfig);

How It Works

Info

Offline mode provides the same API interface as the standard client but operates completely client-side.

The offline mode implements the same interface as the standard client, but with the following differences:

  1. Storage: All consent preferences are stored in the browser's localStorage using the configured key
  2. Network: No network requests are made, all operations happen locally
  3. Consent Banner: The banner visibility is determined by checking if a value exists in localStorage
  4. Consent Verification: Always returns a successful response