Skip to main content

Chat and embeds

Gorgias Chat

Gorgias Chat adds the Gorgias support chat widget to your store or site. The c15t gorgiasChat helper waits for functionality consent before it adds the Gorgias loader. When the widget is ready, the helper turns off its Segment analytics unless measurement is also allowed.

Gorgias has no shutdown API, so the helper can't stop a running widget. By default c15t reloads the page on withdrawal, and the reload stops it.

Configure Gorgias Chat

Copy the public app key from the v3 installation snippet in your Gorgias Chat settings. The key is the last part of https://config.gorgias.chat/bundle-loader/YOUR_APP_KEY. A v2 snippet uses an applicationId instead. Pass that value as appKey with version: 2.

Remove any existing Gorgias snippet or automatic installation from your theme, tag manager or store app. An installation outside c15t can load Gorgias before consent, and the Gorgias loader skips duplicate installations.

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

export const scripts = [gorgiasChat({ appKey: 'YOUR_GORGIAS_APP_KEY' })];

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
appKeyRequiredPublic v3 app key from the installation snippet, or the v2 applicationId with version: 2. Trimmed and URL-encoded. If it's missing or blank, c15t logs gorgiasChat: missing or invalid appKey and never loads Gorgias.
version3Installation snippet version, 2 or 3. Version 3 loads https://config.gorgias.chat/bundle-loader/<appKey>. Version 2 loads https://config.gorgias.chat/gorgias-chat-bundle-loader.js?applicationId=<appKey>.

Loading and revocation

Until its consent gate allows Gorgias, the helper adds no vendor script, creates no vendor global and writes no vendor cookies or storage. The default category is functionality. If you map the script to another category, that category and the visitor's Gorgias vendor switch control the loader.

After consent, c15t appends the loader to <body>. Gorgias then starts the widget asynchronously. The helper listens for gorgias-widget-loaded before it appends the loader. If window.GorgiasChat exists when the loader finishes, it also waits for GorgiasChat.init() to resolve, whichever comes first. When the widget is ready, the helper reads the current measurement choice, not the one from when the loader started.

Revocation, disposal or a loader error cancels the helper's pending readiness work. It can't cancel Gorgias's own startup once the loader has run. If GorgiasChat.init() rejects while consent still allows Gorgias, the helper logs gorgiasChat: chat initialization failed. and stops waiting.

On revocation, c15t removes the loader. If the widget is already ready, the helper also calls disableSegment(), even when measurement is still allowed. Gorgias's close() and hideChat(true) methods only change the widget's visibility. They don't stop its requests or clear its session, and Gorgias documents no full shutdown API. Keep reloadOnConsentRevoked enabled.

When the widget becomes ready without measurement consent, the helper calls GorgiasChat.disableSegment() right away. It also calls it if the visitor withdraws measurement while the widget stays allowed. This follows Gorgias's documented analytics customization.

Gorgias has no call to turn Segment back on. Once it's off, it stays off for that page, even if the visitor then allows measurement. After a reload with measurement allowed, the new widget uses its default analytics.

disableSegment() only works after the widget starts. It doesn't prove that the widget sent no analytics request before its ready event. Check the requests your own widget and account settings produce.

Cookies and storage

The Gorgias help pages don't list the widget's cookie names, storage keys or lifetimes in full. A Chromium probe of the public Gorgias help-center installation found the _dd_s cookie and these localStorage keys after functionality consent: gorgias.ai-agent-state, gorgias.version, gorgias.storage-updated-at and gorgias.language-loaded. They remained after revocation. Account API and collection requests were blocked, so this is a partial list, not a verified chat session. Names and lifetimes can change by version and account.

A reload stops the running widget but doesn't delete cookies or storage that Gorgias already created. Record the widget's storage after you grant consent and again after you start a conversation, then add your own cleanup rules where you need them. Gorgias's chat privacy disclosure can describe how you handle chat data. It doesn't replace the consent gate.

Verify Gorgias Chat

Use your own app key in a private window with an opt-in policy. In DevTools, filter Network by gorgias and check Application for cookies, localStorage and sessionStorage.

  1. Before a choice, and after you reject functionality and reload, no Gorgias script or request appears.
  2. Grant functionality. The loader requests your app key, and the widget appears for an active Gorgias installation.
  3. Leave measurement denied and check the widget's Segment requests. disableSegment() runs after the widget is ready, so check the first load as well as later interactions.
  4. Revoke functionality. The page reloads, and the new page makes no Gorgias request. Check stored data separately, because the reload doesn't remove it.

A placeholder or deleted app key still returns HTTP 200, with only a warning that the installation is incorrect or deleted. That response doesn't prove the widget works. Check that the widget appears.

Sources: customize the chat widget with HTML and JavaScript, HTML snippets for chat customization, add a privacy disclosure, and Gorgias privacy notice.

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 lists its vendor by name in the preference dialog, so 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.