Overview

Compare different approaches to storing consent decisions in your application

c15t provides multiple approaches for storing consent decisions in your application. Each approach has different tradeoffs in terms of:

  • Server requirements
  • Data persistence
  • Implementation complexity
  • User experience

Available Storage Options

Storage OptionDescriptionBest For
Hosted c15tUsing consent.io managed serviceProduction apps with minimal backend maintenance
Self-HostingRunning your own c15t backendOrganizations requiring complete data control
Offline ModeBrowser-based storage with no serverSimple implementations or dev environments
Custom ClientFully customized storage implementationComplex integrations with existing systems

For most applications, we recommend starting with Hosted c15t (consent.io) for the simplest setup with the most features.

Choosing the Right Approach

consent.io provides a fully managed consent management backend with:

  • Zero backend maintenance
  • Built-in scaling and automatic updates
  • Geographic jurisdiction detection
  • Analytics dashboard

Learn more about Hosted c15t

Self-Hosting

Run your own c15t instance to maintain complete control over your data and infrastructure:

  • Full control over data storage and security
  • Integration with your existing database systems
  • Customizable configuration
  • No external service dependencies

Learn more about Self-Hosting

Offline Mode

Store consent decisions entirely in the browser without any server:

  • Zero backend requirements
  • Simplest implementation
  • Works offline and in statically-hosted sites
  • Perfect for development or simple use cases

Learn more about Offline Mode

Custom Client

Implement your own storage logic for complete control:

  • Integration with existing consent management systems
  • Fully customized storage mechanism
  • Advanced caching and batching capabilities
  • Complex multi-tenant scenarios

Learn more about Custom Client

Decision Guide

Use this decision tree to determine which storage option best fits your needs.

  1. Do you need consent data to persist across devices?

    • No → Consider Offline Mode
    • Yes → Continue to question 2
  2. Do you need complete control over your consent data?

    • No → Use Hosted c15t (consent.io)
    • Yes → Continue to question 3
  3. Do you have an existing consent management system?

    • No → Use Self-Hosting
    • Yes → Consider Custom Client

Creating a Client

The main factory function configureConsentManager creates the appropriate client implementation based on the provided options:

import { ConsentManagerProvider, configureConsentManager } from '@c15t/react';
 
// Create a client instance
const options = {
  mode: 'c15t', // 'c15t', 'offline', or 'custom'
  backendURL: '/api/c15t',
  // Other options based on the mode...
};
 
// Use in a React component
function App() {
  return (
    <ConsentManagerProvider options={options}>
      {/* Your app content */}
    </ConsentManagerProvider>
  );
}

Global Callback Events

All client modes support the following callback events:

const callbacks = {
  // Called when any request fails
  onError: (response, path) => {
    console.error(`Request to ${path} failed:`, response.error);
  },
  
  // Called after successfully fetching consent banner information
  onConsentBannerFetched: (response) => {
    console.log('Banner info fetched:', response.data);
  },
  
  // Called after successfully setting consent preferences
  onConsentSet: (response) => {
    console.log('Consent set successfully:', response.data);
  },
  
  // Called after successfully verifying consent
  onConsentVerified: (response) => {
    console.log('Consent verified:', response.data);
  }
};

When to Use Each Mode

Choosing the right mode depends on your specific requirements and constraints.

  • c15t Mode: For production applications with a real c15t backend
  • Offline Mode: For production applications with your own backend systems, or when you want to eliminate external service dependencies
  • Custom Mode: When you need to integrate with an existing consent system but still want to implement custom HTTP request handling

What's Next

Choose the storage approach that best fits your needs:

On this page

c15t.com