Skip known resources?

Created on 20 June 2025, about 2 months ago

Problem/Motivation

I can see there is log or block unknown resources. I do want to keep the log on but there are some sources I know about that I do not want to log or block. For example, we have a client with their own external embeds e.g. via Flourish and other tools. Their own external embeds do not cause any cookies, so I would not watch to make a user accept cookies for them.

Steps to reproduce

Don't add a Service for a known non-cookie external resource

Proposed resolution

Not sure, but perhaps:

  1. A setting to exclude domains from logging
  2. An option in the Services to mark a service as a non-cookie Service and therefore prevent it from showing in the pop-up

Remaining tasks

  1. Decide approach
  2. Merge request

User interface changes

TBD

API changes

TBD

Data model changes

Feature request
Status

Active

Version

3.0

Component

Code

Created by

🇬🇧United Kingdom scott_euser

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

Comments & Activities

  • Issue created by @scott_euser
  • 🇬🇧United Kingdom scott_euser

    Thanks for all the work on this module. Still learning how it works, but I made some suggestions on how it could be approached. If this is something that could be considered and if I could get a general steer I could work on this myself. Thanks!

  • 🇩🇪Germany jan kellermann

    Thank you for feedback!

    You could add the URLs (or part of it) to the Klaro! service. Could you try that please?
    We can add this to the documentation as a quick solution if this works for you.

  • 🇩🇪Germany sascha_meissner Planet earth

    for me, adding the urls to an existing and _enabled_ service works.

    Maybe it would even be more clean if also disabled services are checked, because even if the service is not enabled, it is known?

  • 🇧🇪Belgium andreasderijcke Antwerpen / Gent

    I think 💬 Possible to ignore external resources Active kind of handles the same issue, therefor added as related.

    We're using the OIDC My Citizen Profile Flanders module to add a widget that for Belgian citizens so they can login to the site using their official ID.

    The issue we now have, is that this module, even though all scripts are added to service that is to be required, is still preprocessing the widget scripts to text/plain, replace them post page load.
    This causes the scripts to be loaded 'too late' and the oidc_mcpf module javascript to error, because it counts on those dependencies to be loaded async, and therefor already be present.

    Being able to completely ignore resources (so no script inclusion rewriting in KlaroJsCollectionRenderer either) would solve the problem, without having the other module(s) change their ways.
    This is what issue 💬 Possible to ignore external resources Active comes down to as well, as I understand it.

  • 🇧🇪Belgium andreasderijcke Antwerpen / Gent

    A quick workaround for the case in previous comment, would be to alter

    /**
     * Implements hook_js_alter().
     *
     * Handles script files added from libraries.
     */
    function klaro_js_alter(&$javascript, AttachedAssetsInterface $assets) {
    
      ...
    
      foreach ($javascript as $path => &$script) {
        if ($script['type'] !== 'setting') {
          $app = $helper->matchKlaroApp($path);
          if ($app) {
            $script['preprocess'] = FALSE;
            $script['klaro'] = $app->id();
          }
        }
      }
    }
    

    to

    /**
     * Implements hook_js_alter().
     *
     * Handles script files added from libraries.
     */
    function klaro_js_alter(&$javascript, AttachedAssetsInterface $assets) {
    
      ...
    
      foreach ($javascript as $path => &$script) {
        if ($script['type'] !== 'setting') {
          $app = $helper->matchKlaroApp($path);
          if ($app instanceof KlaroAppInterface && !$app->isRequired()) {
            $script['preprocess'] = FALSE;
            $script['klaro'] = $app->id();
          }
        }
      }
    }

    which will cause all required stuff to be loaded as normal, and might/will have some unwanted side-effects in regards to the 'Only once' option and perhaps others?

Production build 0.71.5 2024