Documentation

Troubleshooting

"Provider not found" Error

Symptom: useConsentManager must be used within a ConsentManagerProvider error.

Fix: Ensure the component calling useConsentManager() (or any c15t hook) is rendered inside a ConsentManagerProvider:

// Wrong — hook is outside the provider
function App() {
  const { consents } = useConsentManager(); // throws
  return <ConsentManagerProvider options={...}>...</ConsentManagerProvider>;
}

// Correct — hook is inside the provider
function App() {
  return (
    <ConsentManagerProvider options={...}>
      <MyComponent /> {/* useConsentManager works here */}
    </ConsentManagerProvider>
  );
}

Scripts Not Loading

Symptom: Third-party scripts configured in the scripts option don't load after consent is granted.

Checklist:

  1. Wrong category name — The category on the script must match one of the consentCategories names. For example, 'measurement' not 'analytics'.

  2. Consent condition not met — Use has('measurement') to verify the category is actually consented.

  3. Script error — Check the browser DevTools Console for script loading errors. The onError callback can help debug:

{
  id: 'analytics',
  src: 'https://...',
  category: 'measurement',
  onError: ({ error }) => console.error('Script failed:', error),
}
  1. Ad blocker — Browser extensions may block the script regardless of consent. The anonymizeId option (default: true) helps avoid pattern-based blocking.