Data Layer Events and Variables
CookieHub provides a set of data layer events and variables that can be effectively utilized in Google Tag Manager to customize and control the behavior of your tags. These events and variables offer valuable insights into user consent and interactions with CookieHub.
Data Layer Events
- cookiehub_consent_update: This event is triggered whenever there is an update in consent mode types. It covers changes in consent settings, including when CookieHub is initially loaded to override defaults.
- cookiehub_ready: Triggered when CookieHub has fully loaded and is ready for use.
- cookiehub_modified: This event occurs when a user makes any changes to allowed or denied categories within CookieHub.
- cookiehub_necessary: Fired when the "Necessary" cookie category is allowed. This can happen because it was previously allowed or when a user enables it in the settings dialog or by clicking the "Allow all cookies" button.
- cookiehub_preferences: Triggered when the "Preferences" cookie category is allowed, under similar conditions as the "Necessary" category.
- cookiehub_analytics: This event is fired when the "Analytics" cookie category is allowed, based on the same criteria as the "Necessary" category.
- cookiehub_marketing: Triggered when the "Marketing" cookie category is allowed, following the same principles as the "Necessary" category.
- cookiehub_uncategorized: This event is fired when the "Uncategorized" cookie category is allowed, in alignment with the criteria for the "Necessary" category.
- cookiehub_click_allow_all: Triggered when a user clicks the "Allow all cookies" button.
- cookiehub_click_deny_all: This event occurs when a user clicks the "Deny all cookies" button.
- cookiehub_click_open_settings: Fired 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: This event is triggered when a user clicks the "Learn more" link to access additional information.
- cookiehub_dialog: This event is triggered when the first layer consent dialog is shown.
- cookiehub_settings: This event is triggered when the settings dialog is shown.
- cookiehub_donotsell: This event is triggered when the IAB GPP/CCPA policy framework is active and a user opts-out of selling and sharing of personal data. This event is available in version >=2.8.2.
Data Layer Variables
The state of each cookie category is stored in data layer variables, enabling you to customize tag loading based on user selections. Here are the variables:
- cookiehub_necessary: A Boolean variable with a default value of "false."
- cookiehub_preferences: A Boolean variable with a default value of "false."
- cookiehub_analytics: A Boolean variable with a default value of "false."
- cookiehub_marketing: A Boolean variable with a default value of "false."
- cookiehub_uncategorized: A Boolean variable with a default value of "false."
- cookiehub_allowsale: A Boolean variable set to false if the user has opted-out of selling and sharing of personal information. This variable is linked to the allow sale function when the IAB GPP/CCPA policy framework is in use. When other policy frameworks are in use, the value will return the consent state of the marketing category as fallback. This variable is available in version >=2.8.2.
These variables offer valuable insights into the user's consent choices, allowing you to tailor your tag management in Google Tag Manager based on the specific preferences and interactions of your website visitors.