Add script attributes to gtm.js

Created on 23 April 2024, 5 months ago
Updated 20 August 2024, 18 days ago

Problem/Motivation

CookiePro and Cookiebot both require adding attributes to the gtm.js script tag to disable automatic blocking of the GTM script. This is needed because GTM can also contain tags which don't require cookie consent and thus should not be blocked. (one should implement Google Consent Mode v2 for this)

https://my.onetrust.com/s/article/UUID-301b21c8-a73a-05e8-175a-36c903672...
https://support.cookiebot.com/hc/en-us/articles/360009063660-Disable-aut...

Proposed resolution

Allow adding attributes to the gtm.js script tag through this modules settings form. It should support tags with and without values, f.e:
data-ot-ignore
data-cookieconsent="ignore"

becomes:

<script async="" src="https://www.googletagmanager.com/gtm.js?id=GTM-xxxxxxx" type="text/javascript" data-ot-ignore data-cookieconsent="ignore"></script>

Feature request
Status

Needs review

Version

2.0

Component

Code

Created by

🇧🇪Belgium matthiasm11

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

Comments & Activities

Production build 0.71.5 2024