---
title: "Callbacks"
description: "Learn how to use callbacks to respond to c15t events in your application."
lastModified: 2025-08-20
availableIn:
  - framework: 'javascript'
    url: '/docs/frameworks/javascript/callbacks'
    title: 'JavaScript'
  - framework: 'next'
    url: '/docs/frameworks/next/callbacks'
    title: 'Next.js'
  - framework: 'react'
    url: '/docs/frameworks/react/callbacks'
    title: 'React'
---
## Implementing Callbacks

```tsx
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               | Type                   | Description                           | Default |  Required  |
| :--------------------- | :--------------------- | :------------------------------------ | :------ | :--------: |
| OnBannerFetchedPayload | OnBannerFetchedPayload | Type alias for OnBannerFetchedPayload | -       | ✅ Required |

### onConsentSet

Called when the consent is set.

| Property            | Type                | Description                        | Default |  Required  |
| :------------------ | :------------------ | :--------------------------------- | :------ | :--------: |
| OnConsentSetPayload | OnConsentSetPayload | Type alias for OnConsentSetPayload | -       | ✅ Required |

### onError

Called when an error occurs.

| Property       | Type           | Description                   | Default |  Required  |
| :------------- | :------------- | :---------------------------- | :------ | :--------: |
| OnErrorPayload | OnErrorPayload | Type alias for OnErrorPayload | -       | ✅ Required |
