Google gtag.js Integration

Auto-block on Google AdWords and Google Analytics

Using the gtag plugin for Qookies.js enables auto-blocking of Google Analytics tracking until users give consent. 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 gtag.js).

Configure the gtag.js Plugin

To configure the gtag.js 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'] = {gtag: true};</script>
        <script src="https://cookies.fo/qookies/v1.2/latest.js></script>

        <!-- rest of head (including the consent banner) -->
    </head>
    <!-- your body -->
</html>
    

If you've configured gtag.js to use a non-default name for the data-layer, pass it into the gtag field instead, e.g. {gtag: 'myCustomLayer'}.