Forums / All Other Contributions/Addons / cookie consent script

cookie consent script

Started by schoolboy on 30 Apr 2012, 12:36 PM · Views: 16,664

Results 1 to 20 of 84
30 Apr 2012, 12:36 PM
#1
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

cookie consent script

We have managed to embed the COOKIE CONSENT system developed by http://www.wolf-software.com, into this "DEMO" site: http://carpclobber.com

Several minor edits, but not too difficult. Though we are TESTING this for any unseen glitches.

20 years a Zencart User

30 Apr 2012, 4:32 PM
#2
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,879
Plugin Contributions:
7

Re: cookie consent script

Looks good.
Have you tested it with other languages (that have accents)? I often find they get mangled.

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...

30 Apr 2012, 4:47 PM
#3
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: cookie consent script

The whole thing is run by a JS file, into which you write appropriate text strings, so I don't see a problem with other languages.

Just load the LIB folder into the root of the server, then add the header code into your template's html_header.php... and away you go.

The header script calls in jquery from google, so if you are running mods calling in jquery (either from Google or elsewhere), then be sure to place the header script into html_header AFTER jquery is called, and to delete the embedded reference to jquery in the bit of script.

One part I am NOT sure on, is:

How do I read the cookie ??

In order to be able to delivery consent that uses non essential cookies you need to be able to check if consent has been given!

if ((isset($_COOKIE['wsjconsent_consent'])) && ($_COOKIE['wsjconsent_consent'] == true)) {
//We are allowed to present the feature that requires cookies
// Your code for feature here
} else {
//We are not allowed to present the feature that requires cookies
// Tell the user that they are getting a less-than-perfect experience?
}

SEE: http://jconsent.dev.wolf-software.com/

20 years a Zencart User

30 Apr 2012, 5:17 PM
#4
sph avatar

sph

Totally Zenned

Join Date:
Jan 2006
Posts:
1,556
Plugin Contributions:
0

Re: cookie consent script

My initial reaction was that it looked like a security warning and might scare people off. But presumably people in the EU will become used to these.

But what about the US, where most of our orders originate? Don't need that scaring people off just yet. Anyway to have it set for EU visitors only? Just a wish.

sph
https://www.prommart.com

Steve
prommart.com

30 Apr 2012, 6:28 PM
#5
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: cookie consent script

This code has a GeoLocation element. It will display ONLY to visitors in the EU. The GeoLocation can be toggled to "true/false", and apparently does not work behind SSL (yet). Wolf is asking for contributions to help fund a SSL-ready version.

But as core ZC is not SSL on the index page, it should not be a problem.

20 years a Zencart User

17 May 2012, 9:09 PM
#6
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: cookie consent script

Hi,

here http://www.zen-cart.com/showthread.php?176015-New-European-Law-restricting-cookies
schoolboy posted the system by http://www.wolf-software.com, detailed over here http://jconsent.dev.wolf-software.com/

I tried the two following

# 1:

I put the lib folder in the root, and added this

<link href="/lib/jconsent/jconsent-default.css" rel="stylesheet" type="text/css" />
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	<script src="/lib/jconsent/jconsent-1.0.1.js"></script>

	<script type="text/javascript">
		$(document).ready( function () {
			$.ws.jconsent({
				displaySettingsSelector: '.displayCookieSettings'
			});
		});
	</script>

to templates/MY_TEMPLATE/common/html_header.php right at the end just before </head>

# 2:
I renamed the following files jconsent-1.0.3.js and jconsent-1.0.3.min.js into
jscript_t_jconsent-1.0.3.js and jscript_t_jconsent-1.0.3.min.js
and put them in templates/MY_TEMPLATE/jscript folder
renamed the jconsent-default.css into style_jconsent-default.css and put it in the templates/MY_TEMPLATE/css folder

In case #1 the slider I have in the header doesn't display, and in case #2 the slider does display, but in both cases the consent script won't display.

What am I doing wrong?

I have a slider in the header using jquery, and the files are in the templates/MY_TEMPLATE/jscript folder.
Site is amberprecious dot com

Thank you

25 May 2012, 12:15 PM
#8
baa avatar

baa

New Zenner

Join Date:
Jul 2007
Posts:
46
Plugin Contributions:
0

Re: cookie consent script

Hello

I've searched the forum to see if this has been answered and I can't find it anywhere.

I've installed Jconsent, a plugin from jconsent.dev.wolf-software.com/ in the hopes it will provide a solution to the EU cookie law issue. I use Google Analytics, AddThis, a little icon to Twitter and YouTube videos onsite and am presuming all or most of these use non-essential cookies?

The bit I'm confused about it how to read the cookie, the quotes below are taken from the webpage in the link provided.

In order to be able to delivery consent that uses non essential cookies you need to be able to check if consent has been given!

PHP
if ((isset($_COOKIE['wsjconsent_consent'])) && ($_COOKIE['wsjconsent_consent'] == true)) {
//We are allowed to present the feature that requires cookies
// Your code for feature here
} else {
//We are not allowed to present the feature that requires cookies
// Tell the user that they are getting a less-than-perfect experience?
}

I'm at a loss as to where to put this, would it go with the code where, for example
the AddThis code is and is there an example of the code to put in available?

I think this is a question that will crop up from time time in the future which is
why I started a new thread.

I don't mind paying a reasonable price for the solution, just let me know if that's how it will be
before Europe starts having to cart wheelbarrows full of cash about just to buy a loaf of bread ;)

25 May 2012, 3:15 PM
#9
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: cookie consent script

"reading the cookies" is hardly the correct term.
You don't actually "read" the cookies at all.

Instead, you simply would not push to the user any code that sets or uses cookies to perform the functions you would normally ask it to do.

So, your "AddThis" or GA code would go in the section you quoted as > // Your code for feature hereie: all the echoing of <script> crap goes in that section. If what you're putting there isn't PHP code then you'll need to end and restart the PHP interpretation with appropriate ?> and <?php statements.

And if you wish to add a message saying "less than optimal experience" in the other section, you can do that too.

Thus it would become:```php

<?php if ((isset($_COOKIE['wsjconsent_consent'])) && ($_COOKIE['wsjconsent_consent'] == true)) { //We are allowed to present the feature that requires cookies // Your code for feature here ?> <script junk for addThis crap and Google Analytics crap here> <?php } else { //We are not allowed to present the feature that requires cookies // Tell the user that they are getting a less-than-perfect experience? ?> <your custom html or javascript code to display said message here> <?php } ?> ``` The site from which you got the code you quoted has some examples for doing those sorts of things.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

25 May 2012, 5:10 PM
#10
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: cookie consent script

Hi,

I had opened a thread which was merged in the following thread, sorry to repost, but it seems the post is not of interest in the thread.

here http://www.zen-cart.com/showthread.p...icting-cookies
schoolboy posted the system by http://www.wolf-software.com, detailed over here http://jconsent.dev.wolf-software.com/

I tried the two following

# 1:

I put the lib folder in the root, and added this

<link href="/lib/jconsent/jconsent-default.css" rel="stylesheet" type="text/css" />
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
	<script src="/lib/jconsent/jconsent-1.0.1.js"></script>

	<script type="text/javascript">
		$(document).ready( function () {
			$.ws.jconsent({
				displaySettingsSelector: '.displayCookieSettings'
			});
		});
	</script>

to templates/MY_TEMPLATE/common/html_header.php right at the end just before </head>

# 2:
I renamed the following files jconsent-1.0.3.js and jconsent-1.0.3.min.js into
jscript_t_jconsent-1.0.3.js and jscript_t_jconsent-1.0.3.min.js
and put them in templates/MY_TEMPLATE/jscript folder
renamed the jconsent-default.css into style_jconsent-default.css and put it in the templates/MY_TEMPLATE/css folder

In case #1 the slider I have in the header doesn't display, and in case #2 the slider does display, but in both cases the consent script won't display.

What am I doing wrong?

I have a slider in the header using jquery, and the files are in the templates/MY_TEMPLATE/jscript folder.
Site is amberprecious dot com

Thank you

25 May 2012, 6:31 PM
#11
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,511
Plugin Contributions:
176

Re: cookie consent script

Threads merged above because they're asking the same questions about how to implement the same thing.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

26 May 2012, 1:18 AM
#12
baa avatar

baa

New Zenner

Join Date:
Jul 2007
Posts:
46
Plugin Contributions:
0

Re: cookie consent script

Thanks for answering Dr. Byte. I know there are examples but I'm pretty useless at anything beyond maintenance on my best day and it's knowing what to actually write that's the problem. The GA bit is fine but the others I wouldn't know where to start.

I suppose the easiest way for those of us who don't know much is to ditch everything and go without anything other than the basic cart.

26 May 2012, 1:24 AM
#13
baa avatar

baa

New Zenner

Join Date:
Jul 2007
Posts:
46
Plugin Contributions:
0

Re: cookie consent script

keneso:

Hi,
I tried the two following

# 1:

I put the lib folder in the root, and added this

<link href="/lib/jconsent/jconsent-default.css" rel="stylesheet" type="text/css" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> <script src="[B]/lib/jconsent/jconsent-1.0.1.js[/B]"></script>
<script type="text/javascript">
    $(document).ready( function () {
        $.ws.jconsent({
            displaySettingsSelector: '.displayCookieSettings'
        });
    });
</script>
> 
> to templates/MY_TEMPLATE/common/html_header.php right at the end just before </head>

Sorry this may seem a really stupid answer but is the filename **jconsent-1.0.1.js **right? On the one I downloaded it was jconsent-1.0.3.js Might be worth checking?
26 May 2012, 10:41 AM
#14
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: cookie consent script

Thanks Baa.
Indeed I totally missed that "detail".

Unfortunatelly I managed to see it display only once!?
And now regardless of clearing the cache, and closing and relaunching the browser it doesn't display anymore, not to mention it does block the slider display.

26 May 2012, 10:55 AM
#15
keneso avatar

keneso

Totally Zenned

Join Date:
May 2009
Posts:
1,273
Plugin Contributions:
3

Re: cookie consent script

Nevermind.

I think I solved it, if someone please checks at amberprecious dot com, and confirms I'll appreciate.
The slider was using jscript_a_jquery-1.6.2.min.js, I deleted that, and put

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

in common/html_header.php right before

  • load all site-wide jscript_*.js files from includes/templates/YOURTEMPLATE/jscript, alphabetically
28 May 2012, 9:14 AM
#16
kenny_1892 avatar

kenny_1892

New Zenner

Join Date:
Mar 2011
Posts:
12
Plugin Contributions:
0

Re: cookie consent script

keneso:

Nevermind.

I think I solved it, if someone please checks at amberprecious dot com, and confirms I'll appreciate.
The slider was using jscript_a_jquery-1.6.2.min.js, I deleted that, and put

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

in common/html_header.php right before

  • load all site-wide jscript_*.js files from includes/templates/YOURTEMPLATE/jscript, alphabetically

That worked fine for me

28 May 2012, 3:19 PM
#17
kitcorsa avatar

kitcorsa

Totally Zenned

Join Date:
Feb 2007
Posts:
1,724
Plugin Contributions:
0

Re: cookie consent script

i tired this and i never worked for me, i chose a different way and use a script from civicuk.com/cookie-law/index again free


30 May 2012, 5:10 PM
#18
pudzpud avatar

pudzpud

Zen Follower

Join Date:
May 2009
Posts:
156
Plugin Contributions:
0

Re: cookie consent script

kitcorsa:

i tired this and i never worked for me, i chose a different way and use a script from civicuk.com/cookie-law/index again free

Hi, can I ask where you installed this script as I have tried on my zencart site by entering the code in english.php but it does not show up on the website. Did you add it someplace else?

I should say I have also tried to enter this script on another site I have which is just basic html and could not get it to work on there either so it may be something I am doing wrong.

31 May 2012, 3:30 PM
#19
kitcorsa avatar

kitcorsa

Totally Zenned

Join Date:
Feb 2007
Posts:
1,724
Plugin Contributions:
0

Re: cookie consent script

  1. go here http://civicuk.com/cookie-law/configuration and scroll down paste the remade codes for wordpress etc and then config the but how you would like it, left right, black white etc and enter the text you would like to display.

2)contiune and collect the code

3)right click and say as on the download button for the javascript.

  1. upload the js to your server

  2. add the code snippet from the website into your includes/templates/mytemple/tmp_header.php remember to change the location to where you upload the javascript file in stage 4

  3. done


you will need to add information on what cookies your site uses on people mechines etc and what they do etc. zencart uses session cookie and zenid cookies as standard, but you might also use google analytic cookie, youtube cookie, google adwords cookie if you have banner etc


31 May 2012, 4:42 PM
#20
schoolboy avatar

schoolboy

Totally Zenned

Join Date:
Jun 2005
Location:
Cumbria, UK
Posts:
10,327
Plugin Contributions:
0

Re: cookie consent script

kitcorsa:

  1. go here http://civicuk.com/cookie-law/configuration and scroll down paste the remade codes for wordpress etc and then config the but how you would like it, left right, black white etc and enter the text you would like to display.

2)contiune and collect the code

3)right click and say as on the download button for the javascript.

  1. upload the js to your server

  2. add the code snippet from the website into your includes/templates/mytemple/tmp_header.php remember to change the location to where you upload the javascript file in stage 4

  3. done


you will need to add information on what cookies your site uses on people mechines etc and what they do etc. zencart uses session cookie and zenid cookies as standard, but you might also use google analytic cookie, youtube cookie, google adwords cookie if you have banner etc

Stage 5. Not correct...

CivicUK advises that the code is placed just BEFORE the closing </body> tag, so it goes into tpl_main_page.php (right at the bottom, just before the closing </body> tag.)

20 years a Zencart User