Adding Cookie Consent Banner

I was following the instructions here a user also reported here: Why Cookie Consent Doesn't Show Up?

The script builder gave me two pieces to add into the template editor.

One in the head, the other in the body.

However I see that the editor actually says:

image

And for the body it says:

image

So, for the part to be added into the “body” I can easily just add it in “Footer” section, it doesn’t really matter as it’s going to still be in the body I assume.

For the head, I don’t know where I should put it.

To give you some example of the code to add:

To be added in HEAD

<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.css" />

To be added in BODY (preferably at the end)

<script src="https://cdn.jsdelivr.net/npm/cookieconsent@3/build/cookieconsent.min.js" data-cfasync="false"></script>
<script>
window.cookieconsent.initialise({
  "palette": {
    "popup": {
      "background": "#343c66",
      "text": "#cfcfe8"
    },
    "button": {
      "background": "#f71559"
    }
  },
  "theme": "classic",
  "content": {
    "message": "we use cookies for essential operations",
    "dismiss": "OK",
    "link": "(details)",
    "href": "yadayada.com/privacy"
  }
});
</script>

Now I can’t even say if it’s working anyway because when I add the part that should go in the BODY section (I used Footer in this screenshot but also tried Body), I get a popup on save that simply says “403 error”.

I imagined it was some issue with the content security policy script src setting and added both the domain and the specific URL to the .js (following these instructions) file but it still gives me the same error.

Unfortunately the generic 403 message doesn’t help me understand what’s going wrong here.#

Any idea what to do here?

3 Likes

There’s a theme component that handles cookie consent, but it is about 4 years old, so I’m not sure if it will work:

Sorry if this response was contrary, but maybe try again? I hope this helps.

2 Likes

Thank you @twofoursixeight, as we are going to use only the basic technical (functional) cookies, that could works as well. Cheers

2 Likes

I can confirm this Theme-component is still working. Using it on lastest Test-passed.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.