c15t
/
C15T Logo
Select a framework
Frameworks
Welcome to c15t Docs
Introduction to Consent Management (c15t)
AI Tools Integrations
OSS
Contributing to c15t.com
License
Building Privacy Tools in the Open
Legal
Cookie Policy
Privacy Policy
C15T Logo
HomeFrontendIntegrationsSelf HostChangelog
xbskydiscordgithub1.4k
c15t
/
C15T Logo
Select a framework
Frameworks
Welcome to c15t Docs
Introduction to Consent Management (c15t)
AI Tools Integrations
OSS
Contributing to c15t.com
License
Building Privacy Tools in the Open
Legal
Cookie Policy
Privacy Policy
home-2Docs
chevron-rightFrameworks
chevron-rightReact
chevron-rightHooks
chevron-rightUse-consent-manager
chevron-rightChecking-consent

Checking consent

Check if the user has given consent for a specific purpose with the has() method.

The has() method returns a boolean value and checks if the user has given consent for a specific purpose. It allows for simple & complex checks. This can be used to conditionally render content based on the user's consent, for example.

// Simple check
const hasAnalytics = has('measurement');
const hasMarketing = has('marketing');

// Complex check
const hasAnalyticsAndMarketing = has({
  and: ['measurement', 'marketing'],
})

const hasEitherAnalyticsOrMarketing = has({
  or: ['measurement', 'marketing'],
})

const doesNotHaveMarketing = has({
  not: 'marketing',
})

// Nested checks
const condition = has({
  and: [
    'necessary',
    { or: ['measurement', 'marketing'] },
    { not: 'advertising' },
  ]
})

Available in other SDKs

javascriptJavaScriptnextNext.js
C15T Logo
Leverage native React components for seamless integration and high performance in a robust Consent Management solution that empowers your development team while prioritizing privacy and compliance.
Product
  • Documentation
  • Components
Company
  • GitHub
  • Contact
Legal
  • Privacy Policy
  • Cookie Policy
c15t