Disabled scripts visibility logic conflict

Created on 14 December 2023, 11 months ago
Updated 26 December 2023, 11 months ago

Problem/Motivation

Adding Google Analytics to the disabled scripts caches the script into analytics: public://eu_cookie_compliance/eu_cookie_compliance.script.js
Which is loaded always if user consented to the cookies.

The issue is that Google Analytics has own visibility settings, for example excluding admin related paths. So EU Cookie Compliance sideloading scripts completely ignores it and loads GA on all pages.

Steps to reproduce

- Install Google Analytics (default settings, just add tracking code).
- Install EU Cookie Compliance (default settings).
- Add following code into Disable JavaScripts:

https://www.googletagmanager.com/gtag/js
modules/contrib/google_analytics/js/google_analytics.js

- Visit `admin/content` page.
- In the console you will see

TypeError: Cannot read properties of undefined (reading 'trackUrlFragments')

- The reason is that GA script is sideloaded by EUCC, but Google Analytics didn't provide drupalSettings, because this path is excluded.

Proposed resolution

Better sideloading logic.

๐Ÿ› Bug report
Status

Needs review

Version

1.0

Component

Code

Created by

๐Ÿ‡ฐ๐Ÿ‡ฌKyrgyzstan elaman

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024