Closed (fixed)
Project:
COOKiES Consent Management
Version:
1.0.7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Mar 2021 at 15:08 UTC
Updated:
29 Mar 2021 at 12:59 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
jfeltkampOk, I will fix this asap.
Comment #3
jfeltkampSorry, but I can't reproduce the issue. I need more information about your GTM configuration or a full image of the header as delivered from server and re-rendered by browser.
I suppose this issue is not made by COOKiES module. Please try to disable COOKiES and check again.
Comment #4
bmunslow commentedHi, I can confirm the same issue reported by @kirkkala, with the same environment (drupal/google_tag + drupal/cookies + drupal/cookies_gtag).
Every time you click the "Accept" button, the gtm script is added to the head of the page.
To reproduce:
<script>for each clickComment #5
bmunslow commentedComment #6
kirkkalaThanks @bmunslow for confirming and with a better explanation of the issue. And @JFeltkamp indeed the script does not get duplicated if I disable cookies ´cookies_gtag modules so cannot point out the issue in google_tag module/gtm.
I believe this could be fixed in
cookies_gtag/js/cookies_gtag.jswith some additional checking in theattach/activatebut probably should be addressed for the other submodule js's as well. I have not unfortunately had time to look into this too much since it is not that critical as Google Tag Manager can deal with this (and I also quite suck with javascript).Comment #8
jfeltkampOk, now I can see the Problem (Sorry @kirkkala). Thank you @bmunslow for the tip.
I fixed that in 1.0.x and I also reviewed the other submodules for the same issue.
You were right that the problem also exists there. Now it should work correct.
Would be nice if you could review the master 1.0.x so I will create a new release asap.
Comment #9
kirkkalaBrilliant, thank you @JFeltkamp! I tested with
composer require drupal/cookies:1.0.x-dev#df351c0and the issue indeed is gone for gtag which we use in our setup. That is, I did not test with other submodules but code changes look good to me regarding array vs object as that seemed to be the root cause 👍Comment #10
jfeltkampGreat. Thank you for the feedback @kirkkala.
I tested that in my test environment, where all features are installed - works fine there too.
Created a new release 1.0.8