Add service to block eTracker

Created on 4 December 2024, 18 days ago

Problem/Motivation

Add service to block eTracker ( https://www.drupal.org/project/etracker β†’ )

like available for COOKiES:
https://git.drupalcode.org/project/etracker/-/tree/8.x-3.x/modules/cooki...

That would allow COOKiES users to switch over more easily.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

✨ Feature request
Status

Active

Version

3.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @Anybody
  • πŸ‡©πŸ‡ͺGermany jan kellermann

    jan kellermann β†’ made their first commit to this issue’s fork.

  • πŸ‡©πŸ‡ͺGermany jan kellermann

    Thank you very much for this proposal.

    I just generated a service for eTracker. I have no account and could only check if the scripts are blocked or loaded.

    So please review and give feeback.

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thank you very very much @jan kellermann I'll do so asap! (Or ask a colleague)

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Another feature that would make a lot of sense here would be to fall back to cookieless mode, if no consent is given. Is that possible technically?

    Other services like Posthog allow the same now. So if not yet possible, it might be a general feature request for the library and the module.

  • πŸ‡©πŸ‡ͺGermany jan kellermann

    How can we handle the cookie option? In Matomo for example you have just to push an option. This means nothing is blocked but the option for cookie is triggered by klaro. See this config (in callback_code):

    https://git.drupalcode.org/project/klaro/-/blob/3.x/config/install/klaro...

  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    Thanks for the nice example @jan kellermann!

    In etracker it is data-block-cookies="true"
    (https://lsww.de/etracker/)

  • πŸ‡©πŸ‡ͺGermany jan kellermann

    Here is the documentation:

    <script data-cookieconsent="ignore" type="text/javascript">
      var _etrackerOnReady = typeof _etrackerOnReady === 'undefined' ? [] : _etrackerOnReady;
      function etrackerSetCookieConsent(e) {
        if (Cookiebot.consent.statistics)
          _etrackerOnReady.push(function(){ _etracker.enableCookies('mydomain.com') });
        else
          _etrackerOnReady.push(function(){ _etracker.disableCookies('mydomain.com') });
      };
      window.addEventListener('CookiebotOnConsentReady', etrackerSetCookieConsent, false); 
    </script> 

    We can use _etrackerOnReady.push(function(){ _etracker.enableCookies('mydomain.com') }); or _etrackerOnReady.push(function(){ _etracker.enableCookies('mydomain.com') });

    mydomain.com then must be replaced.

    This could then something like this:

    if (consent == true) {
      _etrackerOnReady.push(function(){ _etracker.enableCookies(window.location.hostname) });
    } else {
      _etrackerOnReady.push(function(){ _etracker.enableCookies(window.location.hostname) });
    }
    
  • πŸ‡©πŸ‡ͺGermany jan kellermann

    @anybody We added now tweo services to eTracker:

    If you want to track every visit and block only cookies, please use the
    service etracker_cookies. Please make sure that cookies are
    deactivated in the eTracker settings. Klaro will activate the cookies after
    consent.

    If you want block tracking before consent at all, activate the
    service etracker.

    We created a test-account for eTracker and tested both configs with success.

    Please review / feedback. Thank you.

Production build 0.71.5 2024