OptanonConsent cookie never gets set

Created on 23 November 2023, about 1 year ago
Updated 24 November 2023, about 1 year ago

I'm attempting to switch from cookiepro to this module on an existing site. I uninstalled the old module, installed this one and added the script id. I used the cookiepro CDN as we had been using that before.

The banner pops up as usual, but no matter what I select the banner reappears on each page load. The OptanonConsent and OptanonAlertBoxClosed cookies are not created, hence why the banner keeps popping up. No browser settings were changed, so I'm not blocking third-party cookies all of a sudden, and have no adblockers enabled.

Interestingly, if I take the cookiepro code and just stick into the html template file, I get the same result as with this module. I reinstalled the cookiepro module, leaving the code in the html.html.twig file, didn't update the module config, and the banner worked as expected again - both cookies were set correctly. So it seems like something in the module is "allowing" the cookies to be set.

Am I missing something in the config process of the cookiepro_plus module?

💬 Support request
Status

Closed: works as designed

Version

1.0

Component

Code

Created by

🇨🇦Canada davemybes Montreal

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

Comments & Activities

  • Issue created by @davemybes
  • Status changed to Postponed: needs info about 1 year ago
  • 🇧🇪Belgium andreasderijcke Antwerpen / Gent

    The banner pops up as usual, but no matter what I select the banner reappears on each page load. The OptanonConsent and OptanonAlertBoxClosed cookies are not created, hence why the banner keeps popping up.

    This behaviour is typical if you're testing on a different domain than the production domain and loading the script from the production CDN, as in that case, the consent cookie will always be created using the production domain.

    From https://my.onetrust.com/s/article/UUID-7478d3b4-18eb-3ac0-a6fd-fb7ebff9f8dc,

    * Test Scripts: This screen provides the Testing CDN script. The testing CDN is not domain specific and can be placed on any site for testing purposes.

    For example, the testing CDN for onetrust.com can work correctly on testonetrust.com as well as staging.onetrust.com.

    * Production Scripts: This screen provides Production CDN script, which should be used on the production website. The production CDN is domain-specific and should only be placed on the website the scripts are generated for.

    For example, the production script for onetrust.com will not work correctly on testonetrust.com. It is only meant to be placed on pages, paths and subdomains of onetrust.com.

    If that is the case, did you enable the 'Enable Testing CDN' in the module settings? (see https://www.drupal.org/files/cookiepro_plus_options_basic.jpg )

    Interestingly, if I take the cookiepro code and just stick into the html template file, I get the same result as with this module.

    This supports previous possible cause.

    I reinstalled the cookiepro module, leaving the code in the html.html.twig file, didn't update the module config, and the banner worked as expected again - both cookies were set correctly.

    So it seems like something in the module is "allowing" the cookies to be set.

    If your config (snippet) if the cookiepro module does contain the '-test' to load from testing CDN, than this makes sense if that's what is missing here.

    If not, then I'm currently at loss too.
    This module is mainly about being able to control CookiePro script options from Drupal config, when to inject it and having the button, cookie list snippets as tokens, blocks etc.
    The cookie creation is still entirely up to the CookiePro script itself.

    Last Drupal version I deployed this on, 10.1.4, all working as expected. But of course, things change.
    What Drupal core version are you using? What script version is published?

    If you're sure all config for this module is correct, can you send me the script ID using contact form on my account (I've just enabled it), so I try to get it running on a test site?

  • 🇨🇦Canada davemybes Montreal

    Great tip about the Testing CDN option - that appears to have fixed the cookie setting issue. I couldn't understand why cookiepro was working with the production code, though, so I checked the code base and we're overriding that code with the -test code in settings.php for non-prod environments. So that explains why it worked with that module.

    I really appreciate your very quick and informative response. And thanks for having a great alternative to cookiepro.

  • Status changed to Closed: works as designed about 1 year ago
  • 🇧🇪Belgium andreasderijcke Antwerpen / Gent

    Glad to hear, and welcome.

Production build 0.71.5 2024