Data layer events and variables

If you import the CookieHub GTM recipe you don’t have to define events and variables manually, but in case you want to do it manually or customize the GTM implementation you can find a list of events and variables published to the data layer.

Data layer events

Name Fires when…
cookiehub_consent_update Triggered any time consent mode types are updated (including when CookieHub is initially loaded to override the defaults)
cookiehub_ready CookieHub has loaded and is ready to use
cookiehub_modified a user has made any change to allowed or denied categories
cookiehub_necessary The  Necessary cookie category has been allowed, either because it has previously been allowed or the user enabled it in the settings dialog or by clicking the Allow all cookies button.
cookiehub_preferences The  Preferences cookie category has been allowed, either because it has previously been allowed or the user enabled it in the settings dialog or by clicking the Allow all cookies button.
cookiehub_analytics The  Analytics cookie category has been allowed, either because it has previously been allowed or the user enabled it in the settings dialog or by clicking the Allow all cookies button.
cookiehub_marketing The  Marketing cookie category has been allowed, either because it has previously been allowed or the user enabled it in the settings dialog or by clicking the Allow all cookies button.
cookiehub_uncategorized The  Uncategorized cookie category has been allowed, either because it has previously been allowed or the user enabled it in the settings dialog or by clicking the Allow all cookies button.
cookiehub_click_allow_all Triggered when a user clicks the  Allow all cookies button
cookiehub_click_deny_all Triggered when a user clicks the  Deny all cookies button
cookiehub_click_open_settings Triggered when a user clicks the settings icon or the  Cookie Settings button
cookiehub_click_save Triggered when a user clicks the  Save settings button in the Cookie Settings dialog
cookiehub_click_learn_more Triggered when a user clicks the  Learn more link

Data layer variables

The state of each category is stored in data layer variables that can be used in GTM to customize the loading of tags based on users selection, the variables stored are:

Name Type Default value
cookiehub_necessary Boolean false
cookiehub_preferences Boolean false
cookiehub_analytics Boolean false
cookiehub_marketing Boolean false
cookiehub_uncategorized Boolean false

Still need help? Contact Us Contact Us