gtag calls needed.
How it works
Katla maps its cookie categories to Google Consent Mode parameters:
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:
- Go to your site’s Widget Settings page
- Set Google Consent Mode to Enabled
- Save changes
'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:
- Sets
gtag('consent', 'default', ...)on mount with all parameters denied (or granted if consent already exists) - Listens for
katla:consentevents and callsgtag('consent', 'update', ...)automatically - Cleans up the event listener on unmount
Vanilla JavaScript setup
For non-React apps using the SDK directly: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:
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
defaultevent with all parameters set todenied - Accept cookies in the Katla widget
- Verify an
updateevent appears with the appropriate parameters set togranted