If your site uses Google Tag Manager, Qookies.js is can send events and variables directly to GTM to use in triggers.
Using the GTM plugin for Qookies.js allows you to handle consents and include scripts directly from GTM. In order to configure the plugin, you'll have to provide Qookies.js the customized Data Layer name (if you use a non default value in GTM).
To configure the GTM Plugin, make sure that you have Qookies.js 1.2 or later installed, and provide the configuration via a script tag added before the Qookies.js include:
<html>
<head>
<script>window['_q_config'] = {gtm: true};</script>
<script src="https://cookies.fo/qookies/qookies.1.2.0.js"></script>
<!-- rest of head (including the consent banner) -->
</head>
<!-- your body -->
</html>
If you've configured GTM to use a non-default name for the data-layer, pass it into the gtm
field instead, e.g. {gtm: 'myCustomLayer'}.
On the GTM side, we'll add a Data Layer Variable to track what consents are given, and add a trigger for each cookie category you use. To begin, log on to your GTM dashboard and open the workspace for the container you want to use.
q-consentVersion 2The cookie category identifiers used by the GTM plugin are:
Configure a trigger for each category you use.