Skip to main content
Google Consent Mode v2 lets you communicate your visitors’ consent choices to Google tags (Analytics, Ads, etc.). When integrated with Katla, consent decisions automatically update Google’s consent parameters — no manual gtag calls needed.

How it works

Katla maps its cookie categories to Google Consent Mode parameters:
Katla categoryGoogle parameters
analyticsanalytics_storage
marketingad_storage, ad_user_data, ad_personalization
When a visitor grants or denies a category, the corresponding Google parameters are set to 'granted' or 'denied'. Categories without a Google equivalent (e.g. functional, personalization) are ignored.

Widget setup

If you use the Katla widget (the <script> tag embed), enable Google Consent Mode in your site’s widget settings:
  1. Go to your site’s Widget Settings page
  2. Set Google Consent Mode to Enabled
  3. Save changes
The widget script will automatically include the GCM bridge. Before any consent is given, all Google parameters default to 'denied'. When the visitor accepts or rejects categories, the script calls gtag('consent', 'update', ...) with the appropriate values.
Make sure the Katla script loads before your Google Analytics or Google Ads tags so the default consent state is set first.

React setup

If you use the @katla.app/sdk React integration, add the <GoogleConsentMode /> component alongside your existing setup:
import {
  KatlaProvider,
  KatlaGuard,
  ConsentBridge,
  GoogleConsentMode,
} from '@katla.app/sdk/react';

function App() {
  return (
    <KatlaProvider siteId="your-site-id">
      <KatlaGuard />
      <ConsentBridge />
      <GoogleConsentMode />
      {/* Your app */}
    </KatlaProvider>
  );
}
The component:
  • Sets gtag('consent', 'default', ...) on mount with all parameters denied (or granted if consent already exists)
  • Listens for katla:consent events and calls gtag('consent', 'update', ...) automatically
  • Cleans up the event listener on unmount

Vanilla JavaScript setup

For non-React apps using the SDK directly:
import { setupGoogleConsentMode } from '@katla.app/sdk';

// Call after the Katla guard script has loaded
const cleanup = setupGoogleConsentMode();

// Later, if needed:
cleanup();
setupGoogleConsentMode() returns a cleanup function that removes the consent change listener.

CCPA mode behavior

When the widget operates in CCPA mode and a visitor opts out of the sale/sharing of personal information, the following Google Consent Mode parameters are set:
ParameterValueReason
ad_storagedeniedOpt-out of sale/sharing
ad_user_datadeniedOpt-out of sale/sharing
ad_personalizationdeniedOpt-out of sale/sharing
analytics_storagegrantedCCPA does not restrict analytics by default
This differs from a GDPR “Reject All” which denies all parameters including analytics.

Verification

Use Google Tag Assistant to verify that consent signals are being sent correctly:
  1. Install the Tag Assistant browser extension
  2. Load your page with Katla and Google Analytics/Ads
  3. Check the Consent tab — you should see a default event with all parameters set to denied
  4. Accept cookies in the Katla widget
  5. Verify an update event appears with the appropriate parameters set to granted