Skip to main content

Chat and support

Intercom

Configure Intercom

Copy the app ID from your Intercom installation snippet, where it is set as app_id. If your workspace is hosted in the EU or Australia, also set apiBase.

npm install @c15t/integrations@alpha
src/consent-scripts.ts
import { intercom } from '@c15t/integrations/intercom';

export const scripts = [intercom({ appId: 'YOUR_APP_ID' })];

Register the scripts

Complete your framework quickstart first. Keep its Inth endpoint, policy, styles and consent UI. Remove the vendor's original script, SDK initializer or tag-manager entry, so the vendor loads only through c15t.

The vendor pages put the helper in src/consent-scripts.ts. If your framework quickstart already has a scripts array, such as the one in c15t.config.ts in the Next.js guide, add the helper to that array instead of creating a second file. The scripts export is a configuration, not an initializer. Add it to the c15t provider you already have, at the registration point for your framework below. These are edits to that provider, not a second provider.

Add the configuration to scripts in c15t.config.ts, next to next.config.ts:

import { defineConsentConfig } from 'c15t/next';
import { scripts } from './src/consent-scripts';

export default defineConsentConfig({ scripts });

Keep the rest of your config, such as mode and routePrefix, in the same call. ConsentRoot reads the config in the browser, so the layout keeps passing only state. App Router, Pages Router and static export all read the same file. See Next.js scripts and embeds.

Options

OptionDefaultBehavior
appIdRequiredSets app_id and the loader URL. The helper trims it. Empty or whitespace-only values log an error and the script does not load.
apiBasehttps://api-iam.intercom.ioRegional API base. INTERCOM_API_BASES from @c15t/integrations/intercom lists us, eu and au.
settingsNoneExtra JSON-serializable settings merged into window.intercomSettings. appId and apiBase override any app_id or api_base here.
scriptSrchttps://widget.intercom.io/widget/<appId>Loader URL override. A blank value falls back to the default.

Loading and revocation

intercom uses the functionality category. Once functionality is allowed, the helper defines a queueing window.Intercom stub, writes window.intercomSettings and loads the messenger. On revocation it removes the script element and calls no Intercom API, including shutdown. The messenger keeps running until c15t reloads the page.

Guard your own Intercom calls

The helper writes settings once, before the messenger loads. It does not update them when a user logs in or out, so send identity changes through Intercom's messenger API yourself. After revocation window.Intercom still exists, so its presence does not mean functionality is allowed. Check the permission first:

src/intercom-user.ts
export function updateIntercomUser(
	functionalityAllowed: boolean,
	userId: string
) {
	if (!functionalityAllowed || typeof window.Intercom !== 'function') return;
	window.Intercom('update', { user_id: userId });
}

Pass the current functionality permission from your framework, for example useConsent('functionality') in React.

Verify Intercom

After you allow functionality, the request to widget.intercom.io/widget/<appId> appears and the messenger shows. Log in and out of your app, and check that the messenger never shows the previous user's conversations.

Test in a private window with an opt-in policy. Open DevTools Network, disable the cache and filter by the vendor's domain:

  1. Load the page. No request goes to the vendor before you choose.
  2. Click Reject, then reload. There is still no vendor request.
  3. Open Privacy settings and allow the helper's category. The vendor script loads without a page reload.
  4. Turn the category off again and save. c15t reloads the page, and the new page makes no vendor request.

c15t reloads on revocation because removing a script element does not stop code that already ran. The vendor's listeners, timers and queued events stay alive until the page unloads. If you set reloadOnConsentRevoked: false, stop the vendor yourself. Register a callback-only script whose onConsentChange calls the vendor's opt-out API, as shown in custom integrations, and check the permission before each of your own event calls. The reload does not delete cookies the vendor already set; see clear on revocation for your framework.

The helper sets vendor to its script ID, so once you declare that vendor a visitor can turn it off inside an allowed category. See vendor consent for your framework. The consent verification guide covers navigation, expiry and hosting checks.