Error Handling & Monitoring

A11yCore provides event hooks for error monitoring and analytics integration. Connect failures to your observability stack for real-time alerting.

Event System

UseA11yCore.on()andA11yCore.off()to subscribe and unsubscribe from events.

EventPayloadDescription
featureEnabledstring (feature key)Fired when any feature is enabled
featureDisabledstring (feature key)Fired when any feature is disabled

Basic Event Listening

JavaScript
// Subscribe to events
A11yCore.on('featureEnabled', (featureName) => {
  console.log('Enabled:', featureName);
});

A11yCore.on('featureDisabled', (featureName) => {
  console.log('Disabled:', featureName);
});

// Unsubscribe
const handler = (name) => console.log(name);
A11yCore.on('featureEnabled', handler);
A11yCore.off('featureEnabled', handler);

Analytics Integrations

Sentry

A11yCore.on('featureEnabled', (feature) => {
  Sentry.addBreadcrumb({
    category: 'a11y',
    message: `Feature enabled: ${feature}`,
    level: 'info',
  });
});

Datadog

A11yCore.on('featureEnabled', (feature) => {
  DD_LOGS.logger.info('A11yCore feature enabled', { feature });
});

A11yCore.on('featureDisabled', (feature) => {
  DD_LOGS.logger.info('A11yCore feature disabled', { feature });
});

Google Analytics 4

A11yCore.on('featureEnabled', (feature) => {
  gtag('event', 'a11y_feature_enabled', {
    feature_name: feature,
  });
});

Mixpanel

A11yCore.on('featureEnabled', (feature) => {
  mixpanel.track('A11y Feature Enabled', { feature });
});

State & Compliance Score

A11yCore provides methods to retrieve current state and a compliance score based on detected issues.

A11yCore.getSettings()Returns a snapshot of all current settings, feature states, and license info
A11yCore.getComplianceScore()Returns a score from 10-100 based on detected accessibility issues (images missing alt, unlabeled interactive elements)

Analytics Consent

If you enable A11yCore's built-in analytics, you must obtain user consent in GDPR regions.

// Grant analytics consent (e.g., after cookie banner acceptance)
A11yCore.analytics.consent(true);

// Revoke consent
A11yCore.analytics.consent(false);