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 category | Google parameters |
|---|
analytics | analytics_storage |
marketing | ad_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.
If you use the Katla widget (the <script> tag embed), enable Google Consent Mode in your site’s widget settings:
- Go to your site’s Widget Settings page
- Set Google Consent Mode to Enabled
- 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:
| Parameter | Value | Reason |
|---|
ad_storage | denied | Opt-out of sale/sharing |
ad_user_data | denied | Opt-out of sale/sharing |
ad_personalization | denied | Opt-out of sale/sharing |
analytics_storage | granted | CCPA 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:
- Install the Tag Assistant browser extension
- Load your page with Katla and Google Analytics/Ads
- Check the Consent tab — you should see a
default event with all parameters set to denied
- Accept cookies in the Katla widget
- Verify an
update event appears with the appropriate parameters set to granted