Zum Inhalt

Set up hybrid tracking correctly with eTracker

eTracker offers the option of tracking without setting cookies. This type of tracking is therefore also possible without the website visitor's consent and can remain active even if all cookies have been rejected. When tracking without cookies, however, data can no longer be collected to the usual extent, so ideally the tracking mode in which cookies are set should be switched to after the user has consented.

In order to enable so-called hybrid tracking, the tracking provider recommends that the eTracker code of CCM19 should not be blocked. In the recommended default configuration, eTracker will not initially set any cookies on its own. However, connections to a third-party server will still be established.

In order to switch to tracking mode with cookies, CCM19 must transmit the information that the website visitor has agreed to the use of eTracker cookies to eTracker. To make this possible, the following code must be stored in a technically necessary integration (for example, the integration of CCM19 itself, which is always present and executed) under "Integrations & Cookies" in the "Source code of the integration" field:

<script defer>
    (function () {
        var intervals = {};

        function updateEtracker() {
            if (typeof window._etracker == 'object'
                && typeof _etracker.enableCookies == 'function'
                && typeof _etracker.disableCookies == 'function'
            ) {
                CCM.acceptedEmbeddings.reduce(function (c,i) { return c || i.name == 'eTracker'; }, false)
                    ? _etracker.enableCookies(window.location.host)
                    : _etracker.disableCookies(window.location.host);
                window.clearInterval(intervals.etracker);
                intervals.etracker = null;
            }
        }

        function updateThirdPartyConsentState() {
            if (intervals.etracker) {
                window.clearInterval(intervals.etracker);
            }
            intervals.etracker = window.setInterval(updateEtracker, 200);
        }

        window.addEventListener('ccm19WidgetClosed', updateThirdPartyConsentState);
        updateThirdPartyConsentState();
    })();
</script>

It is important here that the name of the variable in i.name == 'eTracker' always matches the name of the eTracker integration in CCM19. If the integration is called "eTracker", nothing needs to be changed.