Topic: cookies warning [SOLVED]

Hello.Where I should include the code for a mandatory cookies warning to avoid its deletion every time I update the site?
It should show up in the first page when you access to the site
Thanks

Re: cookies warning [SOLVED]

You'll probably want the code to be present on all pages throughout your site (so that the cookie warning appears if a visitor initially visits a page other than your home page).

The location of the code depends on the code itself (whether it is JavaScript or HTML).

If the code is purely JavaScript, then you can add it to your theme's 'custom.js' JavaScript file (which is loaded into every page throughout your site and will not be overwritten each time the site is published).
For example, if you use the Boma theme, then add the JavaScript code to your site's '_themes/boma/js/custom.js' file.

If the code is HTML, then you can add it to your site's 'layout.tpl' file (which is the base template used for all pages).
Open the '_themes/base/pagetypes/layout.tpl' file in a plain text editor and add the HTML code wherever you want it to be on your web pages (perhaps just before the closing </body> tag at the foot of the page).

Please note that if or when you next upgrade Showkase (for example when a new version is released), both the 'custom.js' and 'layout.tpl' files will be overwritten (with the stock versions included in the installation package) so please make a copy of any custom modifications you make so that you can integrate them into an upgraded (or new) Showkase site.

I hope this helps.
If you experience difficulties with anything, please let me know the code you are looking to use and I'll try to help further.

Re: cookies warning [SOLVED]

Thanks for your answer Steven. I did a quick test but it didn't work. Before to spent hours fighting with the code i'll appreciate if you could have a look to the code I want to use. Or maybe recommend another tested one for me.

The code comes from here: cookieconsent.insites

Something like this:
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
  "palette": {
    "popup": {
      "background": "#000"
    },
    "button": {
      "background": "#f1d600"
    }
  },
  "showLink": false,
  "type": "opt-out"
})});
</script>


But due to the advanced cookie management they say I also have to disable cookies using "callback hook":

The code:
onInitialise: function (status) {
  var type = this.options.type;
  var didConsent = this.hasConsented();
  if (type == 'opt-in' && didConsent) {
    // enable cookies
  }
  if (type == 'opt-out' && !didConsent) {
    // disable cookies
  }
},

onStatusChange: function(status, chosenBefore) {
  var type = this.options.type;
  var didConsent = this.hasConsented();
  if (type == 'opt-in' && didConsent) {
    // enable cookies
  }
  if (type == 'opt-out' && !didConsent) {
    // disable cookies
  }
},

onRevokeChoice: function() {
  var type = this.options.type;
  if (type == 'opt-in') {
    // disable cookies
  }
  if (type == 'opt-out') {
    // enable cookies
  }
},


Could you tell where to put all that code in order to make it work. Or any other solution for these new laws banners that could fit on your site.

Thanks!

Re: cookies warning [SOLVED]

As it is recommended that the Cookie Consent code be placed just before the closing </head> tag on web pages, here's how to incorporate the Cookie Consent code into a Showkase site.

(1) Open the '_themes/base/pagetypes/layout.tpl' file in a plain text editor.
(2) Add the Cookie Consent code (your version copied below) immediately before the closing </head> tag on line 18.

<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.css" />
<script src="//cdnjs.cloudflare.com/ajax/libs/cookieconsent2/3.0.3/cookieconsent.min.js"></script>
<script>
window.addEventListener("load", function(){
window.cookieconsent.initialise({
  "palette": {
    "popup": {
      "background": "#000"
    },
    "button": {
      "background": "#f1d600"
    }
  },
  "showLink": false,
  "type": "opt-out"
})});
</script>

I've tested this myself and it seems to work fine.

The other JavaScript code you quoted (the callback hook code) does not actually do anything by itself. It just shows you where you should add your own custom JavaScript code to enable and disable cookies within your site depending on whether users opt in or out. (You'd need to replace // enable cookies and // disable cookies with your own custom JavaScript code to enable and disable cookies respectively.)

However, the only cookie that a Showkase site uses is a session cookie within Juicebox-Pro.
When a Juicebox-Pro gallery is expanded on a page of its own (when expandInNewPage="TRUE" or when expandInNewPage="AUTO" and the gallery is expanded on an iOS device), Juicebox uses a session cookie to pass the gallery's configuration data on to the new web page (so that the gallery's expanded layout matches that of the embedded gallery).
This is just a session cookie (containing only gallery configuration data and no personal or tracking data) which is automatically deleted when the browser sessions ends. (In fact, I expect that the session cookie will actually expire as soon as its contents are read.)

Showkase does not set or use any persistent tracking cookies so, unless you introduce any custom tracking cookies yourself, cookie consent may not actually be required from visitors to your site.
(Please check with your own country's current cookie laws and regulations regarding session cookies vs tracking cookies.)

Even if you were to incorporate the callback hook code you quoted, there is no way to disable the session cookie functionality within Juicebox-Pro so there is no code that you could add to the callback hook code that would make any difference in this respect (and if you did manage to somehow disable session cookies throughout your site, it would break Juicebox-Pro's functionality).

I hope this helps to clarify things.

Re: cookies warning [SOLVED]

I did what you said and the cookies warning didn't show up so I decided to click the "rebuild" button + "publish" and now it works. Thanks for your help!

Re: cookies warning [SOLVED]

Sorry. I should have mentioned that you would need to republish your site after modifying the 'layout.tpl' file.
(There would have been no need to republish if just adding JavaScript code to the 'custom.js' file.)
I'm glad that you were able to figure this out and that it works for you. Thank you for letting me know.