# c15t JavaScript Docs

Core c15t JavaScript docs for consent management, script loading, callbacks, and integrations.

If you are changing consent flows, consent UI, script loading, server-side setup, or backend configuration in an app that uses this package, start here before editing code.

## Start Here

- [Quickstart](./quickstart.md)
- [Script Loader](./script-loader.md)
- [Callbacks](./callbacks.md)
- [Google Tag Manager](./integrations/google-tag-manager.md)

## Workflow Rules

### Scripts & Integrations

Use this when:
- adding or updating analytics, advertising, or third-party scripts
- gating script loading behind consent categories
- deciding between a premade integration and a custom script

Prefer:
- Check for a premade integration in `@c15t/scripts/*` before writing a custom script.
- Read `script-loader.md` and the relevant page in `integrations/` before implementing script loading.
- Start from the documented Meta Pixel, GTM, Google Tag, PostHog, TikTok Pixel, or other premade integration when it matches the requirement.

If that is not enough:
- Use a custom `createScript` flow only when no premade integration exists or the documented one cannot satisfy the requirement.

Avoid:
- Do not reimplement consent-sync logic if the documented integration already handles it.

Read next:
- [Quickstart](./quickstart.md)
- [Script Loader](./script-loader.md)
- [Google Tag Manager](./integrations/google-tag-manager.md)
- [Meta Pixel](./integrations/meta-pixel.md)

### Consent Runtime Hooks / Callbacks

Use this when:
- running app logic when consent changes
- integrating an unsupported third-party SDK
- deciding whether a callback is necessary

Prefer:
- Prefer built-in integrations and standard runtime configuration before reaching for callbacks.
- Use callbacks when consent changes need to drive app behavior or an unsupported SDK.

Avoid:
- Do not duplicate script-loading behavior in callbacks if a premade script integration already exists.

Read next:
- [Callbacks](./callbacks.md)
- [Quickstart](./quickstart.md)
