Callbacks
Learn how to use callbacks to respond to c15t events in your application.
On this page
Implementing Callbacks
import { configureConsentManager, type ConsentManagerOptions } from 'c15t';
export const c15tConfig: ConsentManagerOptions = {
mode: 'c15t',
backendURL: "https://your-instance.c15t.dev",
callbacks: {
onBannerFetched(response) {
console.log('Consent banner fetched', response);
},
onConsentSet(response) {
console.log('Consent has been saved', response);
},
onError(error) {
console.log('Error', error);
},
}
};
const c15t = configureConsentManager(c15tConfig);
Available callbacks
onBannerFetched
Called when the consent banner is fetched; not invoked when the banner is in offline mode.
Property
Types
onConsentSet
Called when the consent is set.
Property
Types
onError
Called when an error occurs.
Property
Types