Site logo

[Resolved] Cookie Consent Code

Home Forums Support [Resolved] Cookie Consent Code

Home Forums Support Cookie Consent Code

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #641237
    Zad

    Hi,

    I’m trying to include some cookie consent code onto my site to comply with good GDPR practices. I stumbled on a site that provided me with this code (below). What I’m wondering is whether this belongs in GP Hooks in the wp_head section. This is where I’ve put it so far and it seems to be working fine. But I’m nervous as to whether or not I put it in the correct area. I already have some typekit code in there above this code so I’m nervous to add anything. Anyway, thanks!

    <link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.css" />
    <script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.1.0/cookieconsent.min.js"></script>
    <script>
    window.addEventListener("load", function(){
    window.cookieconsent.initialise({
      "palette": {
        "popup": {
          "background": "#252e39"
        },
        "button": {
          "background": "#d46c5b"
        }
      },
      "theme": "classic",
      "position": "bottom-right",
      "content": {
        "message": "This website uses cookies to ensure you get the best experience on our website.",
        "href": "https://www.lesslikely.com/privacy-policy/"
      }
    })});
    </script>
    #641238
    Zad

    I also want to be sure if this code is safe or if anyone here knows of any alternatives. Thanks!

    #641246
    David
    Staff
    Customer Support

    Hi there,

    the wp_head or the wp_footer is the right place for the code.
    Adding it in the footer will mean the code loads after the page, so may reduce render blocking, so better initial page load times.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.