Closed (fixed)
Project:
EU Cookie Compliance (GDPR Compliance)
Version:
7.x-1.22
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Mar 2018 at 14:23 UTC
Updated:
1 Apr 2018 at 10:29 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
svenryen commentedHi @MrMiso. Which version did you upgrade from?
Comment #3
svenryen commentedI've added a fix here and I think this should it should fix the issue.
Comment #5
svenryen commentedComment #6
mrmiso commentedI was on 7.x-1.17 before update. This will work but it renders cookie name variable useless. If you set cookie name your consent will be saved under that name but hasAgreed() will check on 'cookie-agreed' name as settings aren't available if script is loaded in header. You need to load script in header if you want to use hasAgreed() for lets say google analytic check or any other script you don't want to load until user accept cookie consent.
The correct way would be to load cookie name settings from drupal immediately and not on document ready. With that you won't ever have undefined cookie_name. That is my reasoning but I don't know if it is 100% correct. I was looking into when are actual setting from drupal available/loaded and I think it happens in execute function that is called once and is attached to 'body'. How to load them immediately on script load is beyond my knowledge.
Comment #7
mrmiso commentedComment #8
svenryen commentedHmm.. I see your problem.
When I run `Drupal.eu_cookie_compliance.hasAgreed()` right after the script has loaded, it does indeed fail at getting the cookie name, since Drupal.settings isn't available.
Do you have any example of how this can be done? EU Cookie Compliance is not reading these values from Drupal, they are output as part of the header, together with other Drupal settings. I might be able to bypass this though and output the cookie name in pure javascript, I'll look into that. Thanks for following up the issue.
Comment #9
svenryen commentedIf I can recommend an interim solution for you, @MrMiso, can you name your cookie 'cookie-agreed', until we can get this sorted?
Comment #10
svenryen commentedThis patch fixes the issue. Can you help me apply the patch and review, @MrMiso?
Comment #12
svenryen commented