Google Consent Mode (GCM) sends consent signals. By default, Usercentrics automatically connects (maps) these signals to certain services. But if you want to send signals to different services, or set up something totally custom, you can change this default setup using a small event listener script. This article covers the default mapping, and three ways to customize it.
- Remap to a custom service → deactivate native GCM and map consent parameters to a single service.
- Remap privacy parameters / storage types only → keep native GCM active and update only the three storage types.
- Remap to multiple services → deactivate native GCM and map multiple Usercentrics services to Google consent parameters.
Before you start
- You'll need admin access to Configuration > CMP Settings.
- You should be comfortable editing JavaScript and adding it to your page or tag manager.
- For the custom-service and multiple-services scripts below, you must deactivate the Google Consent Mode toggle in Configuration > CMP Settings first. This stops the banner from firing its own consent update event, which would otherwise conflict with your custom script.
Default mapping
Usercentrics CMP maps the values of the consent update event as follows:
| Name | Template Id | Consent Type |
| Conversion Linker | LykAT-gy | ad_storage |
| Display & Video 360 | UekC8ye4S | ad_storage |
| Google Ads | S1_9Vsuj-Q | ad_storage |
| Google Ads Conversion Tracking | twMyStLkn | ad_storage |
| Google Ads Remarketing | B1Hk_zoTX | ad_storage |
| Google Analytics | HkocEodjb7 | analytics_storage |
| Google Analytics 4 | 87JYasXPF | analytics_storage |
| Google Campaign Manager 360 | dyHOCwp5Y | ad_storage |
| Search Ads 360 | DHS2sEi4b | ad_storage |
Please note
ad_user_data and ad_personalization are not set independently in the default Usercentrics mapping. Both follow the same value as ad_storage , if ad_storage is granted, so are these two, if it's denied, so are these two.
The other Google consent-related storage types, (functionality_storage, personalization_storage, and security_storage) are not updated by the native Usercentrics mapping. You can update these separately using a custom event listener.
Set up a custom event listener
Deactivate the Google Consent Mode toggle in Configuration > CMP Settings, if you haven't already.
Go to Implementation > Data Layer & Events and create a new window event.
- Add the event listener script (examples below) to your page, ideally before the banner script loads.
Warning
Add only one event listener. Additional listeners producing update events can disrupt Google tracking.
Remap to a custom service
To base a consent signal on a single service, replace SERVICE NAME with the service name exactly as it appears in the Usercentrics Admin Interface and the dataLayer event. This can be a predefined or custom service.
If a parameter is not needed for your setup, remove it from the serviceMap object.
For this setup, deactivate the Google Consent Mode toggle in Configuration > CMP Settings. This prevents the native Usercentrics mapping from sending a second consent update event.
<script>
window.addEventListener("ucEvent", function(e) {
// Only proceed if event exists, is a consent update, and is explicit
if (e.detail && e.detail.event === "consent_status" && e.detail.type.toLowerCase() === 'explicit') {
// Map GCM v2 keys directly to your CMP service names
var serviceMap = {
ad_user_data: 'SERVICE NAME',
ad_personalization: 'SERVICE NAME',
ad_storage: 'SERVICE NAME',
analytics_storage: 'SERVICE NAME',
functionality_storage: 'SERVICE NAME',
personalization_storage: 'SERVICE NAME',
security_storage: 'SERVICE NAME'
};
// Build the consent update object dynamically
var consentUpdate = {};
Object.entries(serviceMap).forEach(([consentSignal, serviceName]) => {
if (serviceName && e.detail.hasOwnProperty(serviceName)) {
consentUpdate[consentSignal] = e.detail[serviceName] ? 'granted' : 'denied';
}
});
// Update Google Consent Mode if at least one category exists
if (Object.keys(consentUpdate).length > 0) {
gtag('consent', 'update', consentUpdate);
}
}
});
</script>Note: ad_user_data and ad_personalization are listed separately because this script lets you map each one to a different service if you choose to. In the default Usercentrics mapping, both follow the value of ad_storage.
Remap to update privacy parameters / storage types only
The native Usercentrics mapping does not update the following Google storage types:
functionality_storagepersonalization_storagesecurity_storage
You can use a custom event listener to update these parameters based on Usercentrics consent.
To base a consent signal on a single service, replace SERVICE NAME with the service name exactly as it appears in the Usercentrics Admin Interface and the dataLayer event. This can be a predefined or custom service.
If a parameter is not needed for your setup, remove it from the serviceMap object.
Keep the native Google Consent Mode mechanism active in Configuration > CMP Settings. The custom script should contain only these three parameters. Adding the other Consent Mode parameters would cause the native and custom scripts to send overlapping update events, which can affect tracking on Google products.
<script>
window.addEventListener("ucEvent", function(e) {
// Only proceed if event exists, is a consent update, and is explicit
if (e.detail && e.detail.event === "consent_status" && e.detail.type.toLowerCase() === 'explicit') {
// Map GCM v2 keys directly to your CMP service names
var serviceMap = {
functionality_storage: 'SERVICE NAME',
personalization_storage: 'SERVICE NAME',
security_storage: 'SERVICE NAME'
};
// Build the consent update object dynamically
var consentUpdate = {};
Object.entries(serviceMap).forEach(([consentSignal, serviceName]) => {
if (serviceName && e.detail.hasOwnProperty(serviceName)) {
consentUpdate[consentSignal] = e.detail[serviceName] ? 'granted' : 'denied';
}
});
// Update Google Consent Mode if at least one category exists
if (Object.keys(consentUpdate).length > 0) {
gtag('consent', 'update', consentUpdate);
}
}
});
</script>Remap multiple services
Alternatively, you can use an event listener to map multiple custom Usercentrics consents to Google consent parameters.
For this setup, deactivate the Google Consent Mode toggle in Configuration > CMP Settings. This prevents the native Usercentrics mapping from sending a second consent update event.
window.addEventListener('ucEvent', e => {
const c = e.detail;
// Only proceed if c exists, event is 'consent_status', and type is explicit
if (c && c.event === 'consent_status' && c.type && c.type.toLowerCase() === 'explicit')
gtag('consent', 'update', {
ad_storage: (c["TikTok Advertising"] && c["Reddit Advertising"]) ? 'granted' : 'denied',
functionality_storage: (c["Live Chat"] && c["Customer Support Tools"]) ? 'granted' : 'denied'
});
});This pattern can be reused for any Google consent parameter by changing the consent names and the corresponding parameter.